CLASSROOMIO-T-1: Personalize marks and attendance to students
This commit is contained in:
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
// export let lessonId;
|
// export let lessonId;
|
||||||
export let path;
|
export let path;
|
||||||
|
export let isStudent = null;
|
||||||
let show = null;
|
let show = null;
|
||||||
let isStudent = null;
|
|
||||||
|
|
||||||
const { page } = stores();
|
const { page } = stores();
|
||||||
|
|
||||||
@@ -105,13 +105,7 @@
|
|||||||
label: 'Submissions',
|
label: 'Submissions',
|
||||||
to: getNavItemRoute($course.id, 'submissions'),
|
to: getNavItemRoute($course.id, 'submissions'),
|
||||||
hideSortIcon: true,
|
hideSortIcon: true,
|
||||||
show(groupMembers = [], profileId) {
|
show() {
|
||||||
const user = groupMembers.find(
|
|
||||||
(member) => member.profile_id === profileId
|
|
||||||
);
|
|
||||||
|
|
||||||
isStudent = user ? user.role_id === 3 : true;
|
|
||||||
|
|
||||||
return !isStudent;
|
return !isStudent;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -157,7 +151,7 @@
|
|||||||
</PageNav>
|
</PageNav>
|
||||||
<div class="navItems">
|
<div class="navItems">
|
||||||
{#each navItems as navItem}
|
{#each navItems as navItem}
|
||||||
{#if !navItem.show || (typeof navItem.show === 'function' && navItem.show($group.people, $profile.id))}
|
{#if !navItem.show || (typeof navItem.show === 'function' && navItem.show())}
|
||||||
<Expandable
|
<Expandable
|
||||||
label={navItem.label}
|
label={navItem.label}
|
||||||
handleClick={handleMainGroupClick(navItem.to)}
|
handleClick={handleMainGroupClick(navItem.to)}
|
||||||
|
|||||||
@@ -1,31 +1,26 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount, afterUpdate } from 'svelte';
|
|
||||||
|
|
||||||
import Navigation from '../Course/components/Navigation/index.svelte';
|
import Navigation from '../Course/components/Navigation/index.svelte';
|
||||||
// import { lessons, lesson } from '../Course/components/Lesson/store/lessons';
|
// import { lessons, lesson } from '../Course/components/Lesson/store/lessons';
|
||||||
// import { questionnaire } from '../Course/components/Lesson/Exercise/store/exercise';
|
// import { questionnaire } from '../Course/components/Lesson/Exercise/store/exercise';
|
||||||
// import { questionnaireMetaData } from '../Course/components/Lesson/store/answers';
|
// import { questionnaireMetaData } from '../Course/components/Lesson/store/answers';
|
||||||
import { course } from '../Course/store';
|
import { course, group } from '../Course/store';
|
||||||
import Confetti from '../Confetti/index.svelte';
|
import Confetti from '../Confetti/index.svelte';
|
||||||
import { isMobile } from '../../utils/store/useMobile';
|
import { isMobile } from '../../utils/store/useMobile';
|
||||||
|
import { profile } from '../../utils/store/user';
|
||||||
|
|
||||||
export let path = '';
|
export let path = '';
|
||||||
export let isExercisePage = false;
|
export let isExercisePage = false;
|
||||||
|
export let isStudent = false;
|
||||||
|
|
||||||
function setStoreWithData() {
|
$: {
|
||||||
// lessons.set(courseData.lessons);
|
const user = $group.people.find(
|
||||||
// if (courseData.lesson) {
|
(person) => person.profile_id === $profile.id
|
||||||
// lesson.set(courseData.lesson);
|
);
|
||||||
// }
|
|
||||||
// if (courseData.exercise && courseData.exercise.data) {
|
if (user) {
|
||||||
// questionnaire.set(courseData.exercise.data);
|
isStudent = user.role_id === 3;
|
||||||
// questionnaireMetaData.set(courseData.exercise.answers);
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(setStoreWithData);
|
|
||||||
|
|
||||||
afterUpdate(setStoreWithData);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@@ -33,7 +28,7 @@
|
|||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="root">
|
<div class="root">
|
||||||
<Navigation {path} />
|
<Navigation {path} {isStudent} />
|
||||||
<div class="rightBar" class:isMobile={$isMobile}>
|
<div class="rightBar" class:isMobile={$isMobile}>
|
||||||
{#if isExercisePage}
|
{#if isExercisePage}
|
||||||
<Confetti />
|
<Confetti />
|
||||||
|
|||||||
@@ -18,13 +18,13 @@
|
|||||||
} from '../../../components/Course/store';
|
} from '../../../components/Course/store';
|
||||||
import { getLectureNo } from '../../../components/Course/function';
|
import { getLectureNo } from '../../../components/Course/function';
|
||||||
import { fetchCourse } from '../../../utils/services/courses';
|
import { fetchCourse } from '../../../utils/services/courses';
|
||||||
import { profile } from '../../../utils/store/user';
|
|
||||||
import { lessons } from '../../../components/Course/components/Lesson/store/lessons';
|
import { lessons } from '../../../components/Course/components/Lesson/store/lessons';
|
||||||
import { ROLE } from '../../../utils/constants/roles';
|
import { ROLE } from '../../../utils/constants/roles';
|
||||||
import { takeAttendance } from '../../../utils/services/attendance';
|
import { takeAttendance } from '../../../utils/services/attendance';
|
||||||
import { snackbarStore } from '../../../components/Snackbar/store';
|
import { snackbarStore } from '../../../components/Snackbar/store';
|
||||||
import { SNACKBAR_SEVERITY } from '../../../components/Snackbar/constants';
|
import { SNACKBAR_SEVERITY } from '../../../components/Snackbar/constants';
|
||||||
import { attendance } from '../../../utils/store/attendance';
|
import { attendance } from '../../../utils/store/attendance';
|
||||||
|
import { profile } from '../../../utils/store/user';
|
||||||
|
|
||||||
export let courseId;
|
export let courseId;
|
||||||
|
|
||||||
@@ -68,22 +68,16 @@
|
|||||||
setAttendance(data);
|
setAttendance(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
$: students = $group.people.filter(
|
$: students = isStudent
|
||||||
(person) => !!person.profile && person.role_id === ROLE.STUDENT
|
? $group.people.filter(
|
||||||
);
|
(person) => !!person.profile && person.profile.id === $profile.id
|
||||||
|
)
|
||||||
$: {
|
: $group.people.filter(
|
||||||
const user = $group.people.find(
|
(person) => !!person.profile && person.role_id === ROLE.STUDENT
|
||||||
(person) => person.profile_id === $profile.id
|
);
|
||||||
);
|
|
||||||
|
|
||||||
if (user) {
|
|
||||||
isStudent = user.role_id === 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CourseContainer>
|
<CourseContainer bind:isStudent>
|
||||||
<PageNav title="Attendance" />
|
<PageNav title="Attendance" />
|
||||||
<PageBody>
|
<PageBody>
|
||||||
<div class="table rounded-md border border-gray-300 w-full">
|
<div class="table rounded-md border border-gray-300 w-full">
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CourseContainer>
|
<CourseContainer bind:isStudent>
|
||||||
<PageNav title="Lessons">
|
<PageNav title="Lessons">
|
||||||
<div slot="widget">
|
<div slot="widget">
|
||||||
<RoleBasedSecurity allowedRoles="[1,2]">
|
<RoleBasedSecurity allowedRoles="[1,2]">
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
import { fetchCourse, fetchExercises } from '../../../utils/services/courses';
|
import { fetchCourse, fetchExercises } from '../../../utils/services/courses';
|
||||||
import { getLectureNo } from '../../../components/Course/function';
|
import { getLectureNo } from '../../../components/Course/function';
|
||||||
import { fetchMarks } from '../../../utils/services/marks';
|
import { fetchMarks } from '../../../utils/services/marks';
|
||||||
|
import { profile } from '../../../utils/store/user';
|
||||||
|
|
||||||
export let courseId;
|
export let courseId;
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
let borderleftGrey =
|
let borderleftGrey =
|
||||||
'border-r-0 border-t-0 border-b-0 border-l border-gray-300';
|
'border-r-0 border-t-0 border-b-0 border-l border-gray-300';
|
||||||
let students = [];
|
let students = [];
|
||||||
|
let isStudent = false;
|
||||||
|
|
||||||
let lessonMapping = {}; // { lessonId: { exerciseId: exerciseTitle, ... }, ... }
|
let lessonMapping = {}; // { lessonId: { exerciseId: exerciseTitle, ... }, ... }
|
||||||
let studentMarksByExerciseId = {}; // { groupMemberId: { exerciseId: `total_gotten/points`, ... }, ... }
|
let studentMarksByExerciseId = {}; // { groupMemberId: { exerciseId: `total_gotten/points`, ... }, ... }
|
||||||
@@ -85,13 +87,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
students = $group.people.filter(
|
students = isStudent
|
||||||
(person) => !!person.profile && person.role_id === ROLE.STUDENT
|
? $group.people.filter(
|
||||||
);
|
(person) => !!person.profile && person.profile.id === $profile.id
|
||||||
|
)
|
||||||
|
: $group.people.filter(
|
||||||
|
(person) => !!person.profile && person.role_id === ROLE.STUDENT
|
||||||
|
);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CourseContainer>
|
<CourseContainer bind:isStudent>
|
||||||
<PageNav title="Marks" />
|
<PageNav title="Marks" />
|
||||||
|
|
||||||
<PageBody width="w-11/12">
|
<PageBody width="w-11/12">
|
||||||
|
|||||||
@@ -93,15 +93,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$: sortAndFilterPeople($group.people, filterBy);
|
$: 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>
|
</script>
|
||||||
|
|
||||||
<InviationModal />
|
<InviationModal />
|
||||||
@@ -110,7 +101,7 @@
|
|||||||
{deletePerson}
|
{deletePerson}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CourseContainer>
|
<CourseContainer bind:isStudent>
|
||||||
<PageNav title="People" disableSticky={true}>
|
<PageNav title="People" disableSticky={true}>
|
||||||
<slot:fragment slot="widget">
|
<slot:fragment slot="widget">
|
||||||
<RoleBasedSecurity allowedRoles={[1, 2]}>
|
<RoleBasedSecurity allowedRoles={[1, 2]}>
|
||||||
|
|||||||
Reference in New Issue
Block a user