CLASSROOMIO-T-1: Personalize marks and attendance to students

This commit is contained in:
rotimi-best
2021-09-19 20:01:54 +03:00
parent 984a3d5e07
commit 5c9b6b9ae8
6 changed files with 36 additions and 56 deletions
+9 -15
View File
@@ -18,13 +18,13 @@
} from '../../../components/Course/store';
import { getLectureNo } from '../../../components/Course/function';
import { fetchCourse } from '../../../utils/services/courses';
import { profile } from '../../../utils/store/user';
import { lessons } from '../../../components/Course/components/Lesson/store/lessons';
import { ROLE } from '../../../utils/constants/roles';
import { takeAttendance } from '../../../utils/services/attendance';
import { snackbarStore } from '../../../components/Snackbar/store';
import { SNACKBAR_SEVERITY } from '../../../components/Snackbar/constants';
import { attendance } from '../../../utils/store/attendance';
import { profile } from '../../../utils/store/user';
export let courseId;
@@ -68,22 +68,16 @@
setAttendance(data);
});
$: students = $group.people.filter(
(person) => !!person.profile && person.role_id === ROLE.STUDENT
);
$: {
const user = $group.people.find(
(person) => person.profile_id === $profile.id
);
if (user) {
isStudent = user.role_id === 3;
}
}
$: students = isStudent
? $group.people.filter(
(person) => !!person.profile && person.profile.id === $profile.id
)
: $group.people.filter(
(person) => !!person.profile && person.role_id === ROLE.STUDENT
);
</script>
<CourseContainer>
<CourseContainer bind:isStudent>
<PageNav title="Attendance" />
<PageBody>
<div class="table rounded-md border border-gray-300 w-full">
+1 -1
View File
@@ -121,7 +121,7 @@
}
</script>
<CourseContainer>
<CourseContainer bind:isStudent>
<PageNav title="Lessons">
<div slot="widget">
<RoleBasedSecurity allowedRoles="[1,2]">
+10 -4
View File
@@ -21,6 +21,7 @@
import { fetchCourse, fetchExercises } from '../../../utils/services/courses';
import { getLectureNo } from '../../../components/Course/function';
import { fetchMarks } from '../../../utils/services/marks';
import { profile } from '../../../utils/store/user';
export let courseId;
@@ -29,6 +30,7 @@
let borderleftGrey =
'border-r-0 border-t-0 border-b-0 border-l border-gray-300';
let students = [];
let isStudent = false;
let lessonMapping = {}; // { lessonId: { exerciseId: exerciseTitle, ... }, ... }
let studentMarksByExerciseId = {}; // { groupMemberId: { exerciseId: `total_gotten/points`, ... }, ... }
@@ -85,13 +87,17 @@
});
$: {
students = $group.people.filter(
(person) => !!person.profile && person.role_id === ROLE.STUDENT
);
students = isStudent
? $group.people.filter(
(person) => !!person.profile && person.profile.id === $profile.id
)
: $group.people.filter(
(person) => !!person.profile && person.role_id === ROLE.STUDENT
);
}
</script>
<CourseContainer>
<CourseContainer bind:isStudent>
<PageNav title="Marks" />
<PageBody width="w-11/12">
+1 -10
View File
@@ -93,15 +93,6 @@
});
$: sortAndFilterPeople($group.people, filterBy);
$: {
const user: Person = $group.people.find(
(person: { profile_id: number }) => person.profile_id === $profile.id
)!;
if (user) {
isStudent = user.role_id === 3;
}
}
</script>
<InviationModal />
@@ -110,7 +101,7 @@
{deletePerson}
/>
<CourseContainer>
<CourseContainer bind:isStudent>
<PageNav title="People" disableSticky={true}>
<slot:fragment slot="widget">
<RoleBasedSecurity allowedRoles={[1, 2]}>