From 62c3aaf849d8d5f311646578d3299be0f80c4d30 Mon Sep 17 00:00:00 2001 From: Livio Bieri Date: Mon, 30 Oct 2023 11:31:35 +0100 Subject: [PATCH] fix: assigment summary missing _id --- client/src/services/dashboard.ts | 16 ++++++++++++++++ .../dashboard/graphql/types/assignment.py | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/client/src/services/dashboard.ts b/client/src/services/dashboard.ts index c862f424..a320774f 100644 --- a/client/src/services/dashboard.ts +++ b/client/src/services/dashboard.ts @@ -15,7 +15,13 @@ export const fetchStatisticData = async ( courseId: string ): Promise => { try { + console.log("fetching statistics for course ID: ", courseId); const res = await graphqlClient.query(DASHBOARD_COURSE_STATISTICS, { courseId }); + + if (res.error) { + console.error("Error fetching statistics for course ID:", courseId, res.error); + } + return res.data?.course_statistics || null; } catch (error) { console.error(`Error fetching statistics for course ID: ${courseId}`, error); @@ -30,6 +36,11 @@ export const fetchProgressData = async ( const res = await graphqlClient.query(DASHBOARD_COURSE_SESSION_PROGRESS, { courseId, }); + + if (res.error) { + console.error("Error fetching progress for course ID:", courseId, res.error); + } + return res.data?.course_progress || null; } catch (error) { console.error(`Error fetching progress for course ID: ${courseId}`, error); @@ -39,6 +50,11 @@ export const fetchProgressData = async ( export const fetchDashboardConfig = async (): Promise => { try { const res = await graphqlClient.query(DASHBOARD_CONFIG, {}); + + if (res.error) { + console.error("Error fetching dashboard config:", res.error); + } + return res.data?.dashboard_config || null; } catch (error) { console.error("Error fetching dashboard config:", error); diff --git a/server/vbv_lernwelt/dashboard/graphql/types/assignment.py b/server/vbv_lernwelt/dashboard/graphql/types/assignment.py index 9d30555b..4199beba 100644 --- a/server/vbv_lernwelt/dashboard/graphql/types/assignment.py +++ b/server/vbv_lernwelt/dashboard/graphql/types/assignment.py @@ -65,7 +65,9 @@ def create_assignment_summary(course_id, metrics) -> AssignmentStatisticsSummary ) return AssignmentStatisticsSummaryType( - completed_count=completed_count, average_passed=average_passed_completed # noqa + _id=course_id, # noqa + completed_count=completed_count, # noqa + average_passed=average_passed_completed, # noqa )