fix(analytics): show per-student last seen from login and session activity (#674)
* fix(analytics): show per-student last seen from login and session activity Return ISO last-seen timestamps from course analytics instead of pre-formatted strings so the dashboard can format them per student. Batch-fetch last seen for all students and include session activity alongside login events for more accurate, distinct values. Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> * fix(analytics): destructure first row from getLastLogin query results Promise.all returns an array per Drizzle select; nested destructuring is required so loggedInAt and updatedAt are read from row objects. Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>
This commit is contained in:
co-authored by
Rotimi Best
Cursor Agent
parent
bbdb2e9419
commit
f2d7afc590
@@ -8,6 +8,7 @@
|
||||
import * as Table from '@cio/ui/base/table';
|
||||
|
||||
import { courseApi } from '$features/course/api';
|
||||
import { calDateDiff } from '$lib/utils/functions/date';
|
||||
import { t } from '$lib/utils/functions/translations';
|
||||
|
||||
import EmptyState from './empty-state.svelte';
|
||||
@@ -125,7 +126,7 @@
|
||||
</Table.Cell>
|
||||
<Table.Cell class="min-w-[120px] px-4 py-3">
|
||||
<span class="ui:text-muted-foreground text-sm">
|
||||
{student.lastSeen}
|
||||
{student.lastSeen ? calDateDiff(student.lastSeen) : $t('analytics.a_while_ago')}
|
||||
</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell class="min-w-[120px] px-4 py-3">
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface StudentOverview {
|
||||
exercisesSubmitted: number;
|
||||
totalExercises: number;
|
||||
averageGrade: number;
|
||||
lastSeen: string;
|
||||
lastSeen: string | undefined;
|
||||
progressPercentage: number;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user