CLASSROOMIO-T-155:Send email notification to students when exercise status changes
Merge branch 'CLASSROOMIO-T-155' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-155 remove consoles CLASSROOMIO-T-155:Cleanup Improve email and fix fetching exercise in lms CLASSROOMIO-T-155: Improve from name Merge branch 'main' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-155 CLASSROOMIO-T-155:Cleanup CLASSROOMIO-T-155:Implemented the email notification Merge branch 'main' into CLASSROOMIO-T-155 CLASSROOMIO-T-155:Working on the email notification Co-authored-by: Ifeanyi Nwosu <ifeanyi@digdippa.com> Co-authored-by: Rotimi Best <rotimiibitoyeemma@gmail.com> Merge-request: CLASSROOMIO-MR-107 Merged-by: Best Admin <best@digdippa.com>
This commit is contained in:
committed by
Space Cloud
co-authored by
Rotimi Best
parent
21b0583077
commit
bf73c8cf5a
@@ -0,0 +1,70 @@
|
||||
import { supabase } from '$lib/utils/functions/supabase';
|
||||
|
||||
export function fetchSubmissionStatus() {
|
||||
return supabase.from('submissionstatus').select(`*`);
|
||||
}
|
||||
|
||||
export function fetchSubmissions(course_id) {
|
||||
return supabase
|
||||
.from('submission')
|
||||
.select(
|
||||
`
|
||||
id,
|
||||
created_at,
|
||||
answers:question_answer(*),
|
||||
exercise:exercise_id(
|
||||
id, title, due_by,
|
||||
lesson:lesson_id(id, title),
|
||||
questions:question(
|
||||
*,
|
||||
options:option(*),
|
||||
question_type:question_type_id(id, label)
|
||||
)
|
||||
),
|
||||
status_id,
|
||||
course:course_id(*),
|
||||
groupmember:submitted_by(
|
||||
profile(*)
|
||||
)
|
||||
`
|
||||
)
|
||||
.match({
|
||||
course_id
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchSubmission({ courseId, exerciseId, submittedBy }) {
|
||||
return supabase
|
||||
.from('submission')
|
||||
.select(
|
||||
`
|
||||
id,
|
||||
answers:question_answer(*),
|
||||
status_id
|
||||
`
|
||||
)
|
||||
.match({
|
||||
submitted_by: submittedBy,
|
||||
exercise_id: exerciseId,
|
||||
course_id: courseId
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateSubmission(
|
||||
{ id, status_id, total }: { id?: number; status_id?: number; total?: number },
|
||||
otherArgs?: any
|
||||
) {
|
||||
const toUpdate = {
|
||||
status_id
|
||||
};
|
||||
|
||||
if (typeof total === 'number') {
|
||||
toUpdate.total = total;
|
||||
}
|
||||
|
||||
return supabase.from('submission').update(toUpdate, otherArgs).match({ id });
|
||||
}
|
||||
|
||||
export async function updateQuestionAnswer(update, match) {
|
||||
return supabase.from('question_answer').update(update).match(match);
|
||||
}
|
||||
Reference in New Issue
Block a user