From 51ea7a7f7ca240b38ec7354a738860b2371c9811 Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Mon, 18 Mar 2024 19:47:56 +0100 Subject: [PATCH] Ignore learning units that are none --- .../vbv_lernwelt/dashboard/graphql/types/competence.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/vbv_lernwelt/dashboard/graphql/types/competence.py b/server/vbv_lernwelt/dashboard/graphql/types/competence.py index 295485c8..e4a2025c 100644 --- a/server/vbv_lernwelt/dashboard/graphql/types/competence.py +++ b/server/vbv_lernwelt/dashboard/graphql/types/competence.py @@ -51,10 +51,18 @@ def competences( page_id: Page.objects.get(id=page_id).specific.learning_unit for page_id in unique_page_ids } - circles = {lu.id: lu.get_circle() for lu in learning_units.values()} + circles = { + lu.id: c + for lu in learning_units.values() + if lu is not None and (c := lu.get_circle()) is not None + } for completion in completions: learning_unit = learning_units.get(completion.page.id) + + if not learning_unit: + continue + circle = circles.get(learning_unit.id) combined_id = f"{circle.id}-{completion.course_session.id}"