feat: students should move to next lesson on click go to lesson (#230)
* completion * completion * PR Fixes * PR Fixes * fix: progress bug on home page * chore: fix lesson completion issue --------- Co-authored-by: Rotimi Best <best@classroomio.com>
This commit is contained in:
co-authored by
Rotimi Best
parent
db38756cbf
commit
1277bcbfc6
@@ -175,8 +175,17 @@ export function updateLesson(lesson: any, lessonId: Lesson['id']) {
|
||||
.match({ id: lessonId });
|
||||
}
|
||||
|
||||
export function updateLessonCompletion(completion: LessonCompletion) {
|
||||
return supabase.from('lesson_completion').upsert(completion);
|
||||
export function updateLessonCompletion(completion: LessonCompletion, shouldUpdate: boolean) {
|
||||
if (shouldUpdate) {
|
||||
return supabase
|
||||
.from('lesson_completion')
|
||||
.update({
|
||||
is_complete: completion.is_complete
|
||||
})
|
||||
.eq('id', completion.id);
|
||||
} else {
|
||||
return supabase.from('lesson_completion').insert(completion);
|
||||
}
|
||||
}
|
||||
|
||||
export function deleteLesson(lessonId: Lesson['id']) {
|
||||
|
||||
Reference in New Issue
Block a user