From e3090fcfa11f6d56630cf6f2921023e60cf6421a Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 11 Jul 2024 17:44:42 +0200 Subject: [PATCH] Update filter to always display base circles --- client/src/graphql/queries.ts | 1 + .../learningPath/learningPathPage/LearningPathPathView.vue | 5 +++-- server/vbv_lernwelt/course_session/graphql/mutations.py | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/graphql/queries.ts b/client/src/graphql/queries.ts index 0424d394..6d9c13b5 100644 --- a/client/src/graphql/queries.ts +++ b/client/src/graphql/queries.ts @@ -308,6 +308,7 @@ export const COURSE_QUERY = graphql(` description goals profiles + is_base_circle ...CoursePageFields learning_sequences { icon diff --git a/client/src/pages/learningPath/learningPathPage/LearningPathPathView.vue b/client/src/pages/learningPath/learningPathPage/LearningPathPathView.vue index 4fe83e74..0e43eabf 100644 --- a/client/src/pages/learningPath/learningPathPage/LearningPathPathView.vue +++ b/client/src/pages/learningPath/learningPathPage/LearningPathPathView.vue @@ -41,11 +41,12 @@ const scrollLearnPathDiagram = (offset: number) => { const filterCircles = (topic: TopicType) => { // return []; - if (props.filter === undefined) { + if (props.filter === undefined || props.filter === "") { return topic.circles; } return topic.circles.filter( - (circle) => circle.profiles.indexOf(props.filter as string) > -1 + (circle) => + circle.profiles.indexOf(props.filter as string) > -1 || circle.is_base_circle ); }; diff --git a/server/vbv_lernwelt/course_session/graphql/mutations.py b/server/vbv_lernwelt/course_session/graphql/mutations.py index 6ecaad20..4716999f 100644 --- a/server/vbv_lernwelt/course_session/graphql/mutations.py +++ b/server/vbv_lernwelt/course_session/graphql/mutations.py @@ -95,8 +95,12 @@ class CourseSessionProfileMutation(relay.ClientIDMutation): course_profile = input.get("course_profile") course_slug = input.get("course_slug") user = info.context.user + try: - profile = CourseProfile.objects.get(code=course_profile) + if course_profile == "": + profile = None + else: + profile = CourseProfile.objects.get(code=course_profile) # csu = user.coursesessionuser_set.first() csu = CourseSessionUser.objects.get(