chore: use session to update lastSeen and UI tweaks
This commit is contained in:
@@ -81,8 +81,6 @@
|
||||
}
|
||||
|
||||
$: gradeWithAI = isGradeWithAI;
|
||||
|
||||
$: console.log('grade', grade, 'hideGrading', hideGrading);
|
||||
</script>
|
||||
|
||||
<form on:submit|preventDefault={handleFormSubmit}>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user