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 <[email protected]> Co-authored-by: Rotimi Best <[email protected]> Merge-request: CLASSROOMIO-MR-107 Merged-by: Best Admin <[email protected]>
This commit is contained in:
committed by
Space Cloud
co-authored by
Rotimi Best
parent
21b0583077
commit
bf73c8cf5a
@@ -64,7 +64,7 @@ export async function fetchLMSExercises(
|
||||
total,
|
||||
groupmember:submitted_by!inner (
|
||||
id,
|
||||
profile!inner (
|
||||
profile:profile_id!inner (
|
||||
id
|
||||
)
|
||||
)
|
||||
@@ -79,12 +79,12 @@ export async function fetchLMSExercises(
|
||||
group:group_id!inner (
|
||||
organisation:organization_id!inner (
|
||||
id
|
||||
)
|
||||
),
|
||||
groupmember:group_id!inner(
|
||||
id,
|
||||
profile!inner (
|
||||
id
|
||||
),
|
||||
groupmember!inner(
|
||||
id,
|
||||
profile:profile_id!inner (
|
||||
id
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -92,7 +92,7 @@ export async function fetchLMSExercises(
|
||||
`
|
||||
)
|
||||
.eq('lesson.course.group.organisation.id', orgId)
|
||||
.eq('lesson.course.groupmember.profile.id', profileId)
|
||||
.eq('lesson.course.group.groupmember.profile.id', profileId)
|
||||
.eq('submission.groupmember.profile.id', profileId);
|
||||
|
||||
return {
|
||||
|
||||
@@ -7,7 +7,8 @@ export const NOTIFICATION_NAME = {
|
||||
SEND_TEACHER_STUDENT_BUY_REQUEST: 'SEND TEACHER STUDENT BUY REQUEST',
|
||||
STUDENT_PROOVE_COURSE_PAYMENT: 'STUDENT PROOVE COURSE PAYMENT',
|
||||
STUDENT_COURSE_WELCOME: 'STUDENT COURSE WELCOME',
|
||||
TEACHER_STUDENT_JOINED: 'TEACHER STUDENT JOINED'
|
||||
TEACHER_STUDENT_JOINED: 'TEACHER STUDENT JOINED',
|
||||
SUBMISSION_UPDATE: 'SUBMISSION UPDATE'
|
||||
};
|
||||
|
||||
const NAME_TO_PATH = {
|
||||
@@ -18,12 +19,12 @@ const NAME_TO_PATH = {
|
||||
'/api/email/course/teacher_student_buycourse',
|
||||
[NOTIFICATION_NAME.STUDENT_PROOVE_COURSE_PAYMENT]: '/api/email/course/student_prove_payment',
|
||||
[NOTIFICATION_NAME.STUDENT_COURSE_WELCOME]: '/api/email/course/student_welcome',
|
||||
[NOTIFICATION_NAME.TEACHER_STUDENT_JOINED]: '/api/email/course/teacher_student_joined'
|
||||
[NOTIFICATION_NAME.TEACHER_STUDENT_JOINED]: '/api/email/course/teacher_student_joined',
|
||||
[NOTIFICATION_NAME.SUBMISSION_UPDATE]: '/api/email/course/submission_update'
|
||||
};
|
||||
|
||||
const getAccessToken = async () => {
|
||||
const { data } = await supabase.auth.getSession();
|
||||
|
||||
return data.session?.access_token || '';
|
||||
};
|
||||
|
||||
@@ -36,7 +37,6 @@ export const triggerSendEmail = async (name: string, body: { [k: string]: any })
|
||||
console.error('Could not trigger send');
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await fetch(path, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -46,11 +46,10 @@ export const triggerSendEmail = async (name: string, body: { [k: string]: any })
|
||||
body: JSON.stringify(body)
|
||||
});
|
||||
if (!response.ok) {
|
||||
console.log(response);
|
||||
throw new Error(await response.text());
|
||||
}
|
||||
const result = await response.json();
|
||||
|
||||
console.log(name, result);
|
||||
} catch (error) {
|
||||
console.error(name, error);
|
||||
}
|
||||
|
||||
+7
-4
@@ -29,7 +29,7 @@ export function fetchSubmissions(course_id) {
|
||||
`
|
||||
)
|
||||
.match({
|
||||
course_id,
|
||||
course_id
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,13 +46,16 @@ export async function fetchSubmission({ courseId, exerciseId, submittedBy }) {
|
||||
.match({
|
||||
submitted_by: submittedBy,
|
||||
exercise_id: exerciseId,
|
||||
course_id: courseId,
|
||||
course_id: courseId
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateSubmission({ id, status_id, total }, otherArgs) {
|
||||
export async function updateSubmission(
|
||||
{ id, status_id, total }: { id?: number; status_id?: number; total?: number },
|
||||
otherArgs?: any
|
||||
) {
|
||||
const toUpdate = {
|
||||
status_id,
|
||||
status_id
|
||||
};
|
||||
|
||||
if (typeof total === 'number') {
|
||||
Reference in New Issue
Block a user