People: filter, add student id, submit homework
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
export const STATUS = {
|
||||
PENDING: 0,
|
||||
IN_PROGRESS: 1,
|
||||
REVIEWED: 2,
|
||||
};
|
||||
@@ -9,3 +9,22 @@ export const ROLE_LABEL = {
|
||||
[ROLE.TUTOR]: 'Tutor',
|
||||
[ROLE.STUDENT]: 'Student',
|
||||
};
|
||||
|
||||
export const ROLES = [
|
||||
{
|
||||
label: 'All',
|
||||
value: 'all',
|
||||
},
|
||||
{
|
||||
label: ROLE_LABEL[ROLE.ADMIN],
|
||||
value: ROLE.ADMIN,
|
||||
},
|
||||
{
|
||||
label: ROLE_LABEL[ROLE.TUTOR],
|
||||
value: ROLE.TUTOR,
|
||||
},
|
||||
{
|
||||
label: ROLE_LABEL[ROLE.STUDENT],
|
||||
value: ROLE.STUDENT,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -122,6 +122,13 @@ export function addGroupMember(member) {
|
||||
});
|
||||
}
|
||||
|
||||
export function updatedGroupMember(update, match) {
|
||||
return supabase
|
||||
.from('groupmember')
|
||||
.update(update, { returning: 'minimal' })
|
||||
.match(match);
|
||||
}
|
||||
|
||||
export function deleteGroupMember(groupMemberId) {
|
||||
return supabase.from('groupmember').delete().match({ id: groupMemberId });
|
||||
}
|
||||
@@ -296,13 +303,9 @@ export async function submitExercise(
|
||||
group,
|
||||
profile
|
||||
) {
|
||||
let groupMember;
|
||||
|
||||
if (Array.isArray(group.tutors)) {
|
||||
groupMember = group.tutors.find(
|
||||
(student) => student.profile_id === profile.id
|
||||
);
|
||||
}
|
||||
const groupMember = group.people.find(
|
||||
(person) => person.profile_id === profile.id
|
||||
);
|
||||
console.log(`groupMember`, groupMember);
|
||||
if (!groupMember) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user