* add cloud translation api package * feat: Script that auto generates translations for other languages * add comments * fix: broken translation * improve translation * update locck file * clean up * all round trasnlations check * checkpoint * finish up * move to dev dependencies * fix vercel build error * translations fix * - add documentation - translation bug fix * quick adjust * PR Fixes * add new line * update docs * checkpoint * feat: redesign & addition of certificates * text color update * patterned width fix * "student-name" class remove * checkpoint * PR Fix * quick fix * PR Fixes * update certificate ready page for students * PR Fixes * quick cleanup * move fetchCourses into .ts file * feat: give students access to certificates only after completing course * checkpoint * height fix * Merge branch 'main' of https://github.com/rotimi-best/classroomio into classroomio-issue-272 * Fix; merge PR Fix * fix: width of plain & professional certs * PR Fix * feat: add translation * handle error when trying to download a certificate * add fetchExploreCourses * fix: requested reviews * review fixes checkpoint * replace the certificate background * height fix for patterned certififcates * fix more bugs * rename schema --------- Co-authored-by: Rotimi Best <[email protected]>
31 lines
1.1 KiB
PL/PgSQL
31 lines
1.1 KiB
PL/PgSQL
set check_function_bodies = off;
|
|
|
|
CREATE OR REPLACE FUNCTION public.get_course_progress(course_id_arg uuid, profile_id_arg uuid)
|
|
RETURNS TABLE(lessons_count bigint, lessons_completed bigint, exercises_count bigint, exercises_completed bigint)
|
|
LANGUAGE plpgsql
|
|
AS $function$
|
|
BEGIN
|
|
RETURN QUERY
|
|
select
|
|
count(lesson.id) as lessons_count,
|
|
count(lesson_completion.id) as lessons_completed,
|
|
count(exercise.id) as exercises_count,
|
|
count(submission.id) as exercises_completed
|
|
from
|
|
course
|
|
join "group" on "group".id = course.group_id
|
|
join groupmember on groupmember.group_id = course.group_id
|
|
join profile on profile.id = groupmember.profile_id
|
|
left join lesson on lesson.course_id = course.id
|
|
left join lesson_completion on lesson_completion.lesson_id = lesson.id
|
|
and lesson_completion.is_complete = true
|
|
and lesson_completion.profile_id = profile.id
|
|
left join exercise on exercise.lesson_id = lesson.id
|
|
left join submission on submission.exercise_id = exercise.id
|
|
and submission.submitted_by = groupmember.id
|
|
where
|
|
course.id = course_id_arg
|
|
and profile.id = profile_id_arg;
|
|
END;
|
|
$function$
|
|
; |