diff --git a/apps/dashboard/src/lib/components/Question/CheckboxQuestion/index.svelte b/apps/dashboard/src/lib/components/Question/CheckboxQuestion/index.svelte index 24b0e808..1075fafa 100644 --- a/apps/dashboard/src/lib/components/Question/CheckboxQuestion/index.svelte +++ b/apps/dashboard/src/lib/components/Question/CheckboxQuestion/index.svelte @@ -81,8 +81,6 @@ } $: gradeWithAI = isGradeWithAI; - - $: console.log('grade', grade, 'hideGrading', hideGrading);
diff --git a/apps/dashboard/src/lib/utils/types/index.ts b/apps/dashboard/src/lib/utils/types/index.ts index 4a90b8c9..768b0a08 100644 --- a/apps/dashboard/src/lib/utils/types/index.ts +++ b/apps/dashboard/src/lib/utils/types/index.ts @@ -421,15 +421,3 @@ interface Tabs { id: number; name: string; } - -export interface StudentStat { - username: string; - progressPercentage: number; - pendingCourses: Course[]; - completedCourses: Course[]; - totalLessons: number; - totalLessonsCompleted: number; - totalExercise: number; - totalExercisesCompleted: number; - totalLmsEntry: number; -} \ No newline at end of file diff --git a/apps/dashboard/src/routes/api/analytics/user/+server.ts b/apps/dashboard/src/routes/api/analytics/user/+server.ts index 254a73ae..51247199 100644 --- a/apps/dashboard/src/routes/api/analytics/user/+server.ts +++ b/apps/dashboard/src/routes/api/analytics/user/+server.ts @@ -10,7 +10,7 @@ import { json } from '@sveltejs/kit'; const supabase = getServerSupabase(); -const CACHE_DURATION = 60; // 1 minute +const CACHE_DURATION = 60 * 5; // 5 minutes export async function POST({ setHeaders, request }) { const { userId, courseId, orgId } = await request.json(); diff --git a/apps/dashboard/src/routes/courses/[id]/people/[personId]/+page.svelte b/apps/dashboard/src/routes/courses/[id]/people/[personId]/+page.svelte index 1b5d0bdc..b88e91c7 100644 --- a/apps/dashboard/src/routes/courses/[id]/people/[personId]/+page.svelte +++ b/apps/dashboard/src/routes/courses/[id]/people/[personId]/+page.svelte @@ -130,7 +130,7 @@ interactive filter={exerciseFilter === 'incomplete'} type={exerciseFilter === 'incomplete' ? 'gray' : 'outline'} - class="text-yellow-700 dark:text-yellow-500" + class="lowercase text-yellow-700 dark:text-yellow-500" on:click={() => toggleExerciseFilter('incomplete')} > {incompleteExercises} @@ -140,7 +140,7 @@ interactive filter={exerciseFilter === 'completed'} type={exerciseFilter === 'completed' ? 'gray' : 'outline'} - class="text-green-700 dark:text-green-500" + class="lowercase text-green-700 dark:text-green-500" on:click={() => toggleExerciseFilter('completed')} > {completedExercises} diff --git a/supabase/migrations/20241016235827_student_analytics.sql b/supabase/migrations/20241016235827_student_analytics.sql index 1624f5be..c3d44bdb 100644 --- a/supabase/migrations/20241016235827_student_analytics.sql +++ b/supabase/migrations/20241016235827_student_analytics.sql @@ -47,14 +47,16 @@ FOR EACH ROW EXECUTE FUNCTION public.insert_login_event_on_user_login(); CREATE OR REPLACE FUNCTION public.insert_login_event_on_user_session_update() - RETURNS trigger + RETURNS trigger LANGUAGE plpgsql SECURITY DEFINER AS $function$ BEGIN IF (NEW.updated_at IS NOT NULL) THEN INSERT INTO public.analytics_login_events (logged_in_at, user_id) - VALUES (NEW.updated_at, NEW.user_id); + VALUES (NEW.updated_at, NEW.user_id) + ON CONFLICT (user_id) DO UPDATE + SET logged_in_at = NEW.updated_at; END IF; RETURN NEW; END;