From dd1d1ff6feed38824f3c81718f20512c502ae74b Mon Sep 17 00:00:00 2001
From: Ramon Wenger
Date: Thu, 4 Jul 2024 09:45:18 +0200
Subject: [PATCH] Add proof of concept implementation for the profile filter
---
client/src/gql/schema.graphql | 1 +
client/src/graphql/queries.ts | 1 +
.../learningPathPage/LearningPathPage.vue | 17 ++++++++++-----
.../learningPathPage/LearningPathPathView.vue | 17 +++++++++++++--
server/vbv_lernwelt/course/models.py | 4 ++++
.../vbv_lernwelt/learnpath/graphql/types.py | 12 +++++++----
server/vbv_lernwelt/learnpath/models.py | 21 +++++++++++++++++++
7 files changed, 62 insertions(+), 11 deletions(-)
diff --git a/client/src/gql/schema.graphql b/client/src/gql/schema.graphql
index 14d5f4ed..1ba76b89 100644
--- a/client/src/gql/schema.graphql
+++ b/client/src/gql/schema.graphql
@@ -356,6 +356,7 @@ type CircleObjectType implements CoursePageInterface {
frontend_url: String!
course: CourseObjectType
learning_sequences: [LearningSequenceObjectType!]!
+ profiles: [String]!
}
type LearningSequenceObjectType implements CoursePageInterface {
diff --git a/client/src/graphql/queries.ts b/client/src/graphql/queries.ts
index dbd1ea33..89357f20 100644
--- a/client/src/graphql/queries.ts
+++ b/client/src/graphql/queries.ts
@@ -298,6 +298,7 @@ export const COURSE_QUERY = graphql(`
circles {
description
goals
+ profiles
...CoursePageFields
learning_sequences {
icon
diff --git a/client/src/pages/learningPath/learningPathPage/LearningPathPage.vue b/client/src/pages/learningPath/learningPathPage/LearningPathPage.vue
index 0e051681..4234f14c 100644
--- a/client/src/pages/learningPath/learningPathPage/LearningPathPage.vue
+++ b/client/src/pages/learningPath/learningPathPage/LearningPathPage.vue
@@ -12,7 +12,6 @@ import {
useCourseDataWithCompletion,
useCurrentCourseSession,
} from "@/composables";
-import CourseSessionDueDatesList from "@/components/dueDates/CourseSessionDueDatesList.vue";
const props = defineProps<{
courseSlug: string;
@@ -33,6 +32,8 @@ const course = computed(() => lpQueryResult.course.value);
const courseSession = useCurrentCourseSession();
+const filter = ref("");
+
const { inProgressCirclesCount, circlesCount } = useCourseCircleProgress(
lpQueryResult.circles
);
@@ -66,10 +67,15 @@ const changeViewType = (viewType: ViewType) => {
@@ -101,6 +107,7 @@ const changeViewType = (viewType: ViewType) => {
diff --git a/client/src/pages/learningPath/learningPathPage/LearningPathPathView.vue b/client/src/pages/learningPath/learningPathPage/LearningPathPathView.vue
index 7150b719..7aad40c6 100644
--- a/client/src/pages/learningPath/learningPathPage/LearningPathPathView.vue
+++ b/client/src/pages/learningPath/learningPathPage/LearningPathPathView.vue
@@ -3,7 +3,11 @@ import LearningPathCircleColumn from "@/pages/learningPath/learningPathPage/Lear
import LearningPathScrollButton from "@/pages/learningPath/learningPathPage/LearningPathScrollButton.vue";
import { useScroll } from "@vueuse/core";
import { ref } from "vue";
-import type { LearningContentWithCompletion, LearningPathType } from "@/types";
+import type {
+ LearningContentWithCompletion,
+ LearningPathType,
+ TopicType,
+} from "@/types";
import LoadingSpinner from "@/components/ui/LoadingSpinner.vue";
const props = defineProps<{
@@ -12,6 +16,7 @@ const props = defineProps<{
useMobileLayout: boolean;
hideButtons?: boolean;
overrideCircleUrlBase?: string;
+ filter?: string;
}>();
const scrollIncrement = 600;
@@ -33,6 +38,14 @@ const scrollLeft = () => scrollLearnPathDiagram(-scrollIncrement);
const scrollLearnPathDiagram = (offset: number) => {
x.value += offset;
};
+
+const filterCircles = (topic: TopicType) => {
+ // return [];
+ if (props.filter) {
+ return topic.circles.filter((circle) => circle.profiles.indexOf(props.filter) > -1);
+ }
+ return topic.circles;
+};
@@ -65,7 +78,7 @@ const scrollLearnPathDiagram = (offset: number) => {