feat: org and course student analytics page (#509)

* UI initialization

* feat: structure API

* feat: audience & people analytics

* feat: quick changes

* feat: add comments

* redesign course student page

* chore: make requests to db more efficient

* clean up analytics page for course

* feat: finish up audience analytics page

* chore: minor UI tweaks

* translate all

* replace inserts of log in events to update

* catch error if last_login isn't inserted

---------

Co-authored-by: Rotimi Best <best@classroomio.com>
This commit is contained in:
Adeyemi Adetunji
2024-12-30 02:59:10 +01:00
committed by GitHub
co-authored by Rotimi Best
parent 381776f388
commit f69bf920a9
46 changed files with 1916 additions and 437 deletions
@@ -253,6 +253,17 @@ export function deleteGroupMember(groupMemberId: Groupmember['id']) {
return supabase.from('groupmember').delete().match({ id: groupMemberId });
}
export async function getMarks(courseId) {
if (!courseId) return;
// Gets courses for a particular organisation where the current logged in user is a groupmember
const { data: marks } = await supabase
.rpc('get_marks')
.eq('course_id', courseId);
return { marks };
}
export function fetchLesson(lessonId: Lesson['id']) {
return supabase
.from('lesson')
@@ -1,4 +1,4 @@
import { supabase } from '$lib/utils/functions/supabase';
import { getAccessToken } from '$lib/utils/functions/supabase';
export const NOTIFICATION_NAME = {
WELCOME_TO_APP: 'WELCOME TO APP',
@@ -29,11 +29,6 @@ const NAME_TO_PATH = {
[NOTIFICATION_NAME.NEWSFEED]: '/api/email/course/newsfeed'
};
const getAccessToken = async () => {
const { data } = await supabase.auth.getSession();
return data.session?.access_token || '';
};
export const triggerSendEmail = async (name: string, body: { [k: string]: unknown }) => {
try {
const accessToken = await getAccessToken();