diff --git a/client/src/components/learningPath/LearningPathDiagram.vue b/client/src/components/learningPath/LearningPathDiagram.vue index a2c3b946..7504fc7d 100644 --- a/client/src/components/learningPath/LearningPathDiagram.vue +++ b/client/src/components/learningPath/LearningPathDiagram.vue @@ -20,21 +20,21 @@ export interface Props { profileUserId?: string; learningPath: LearningPath; // set to undefined (default) to show all circles - showCircleIds?: number[]; + showCircleTranslationKeys: string[]; } const props = withDefaults(defineProps(), { diagramType: "horizontal", postfix: "", profileUserId: "", - showCircleIds: undefined, + showCircleTranslationKeys: undefined, }); log.debug( "LearningPathDiagram created", props.postfix, props.profileUserId, - props.showCircleIds + props.showCircleTranslationKeys ); const state = reactive({ width: 1640, height: 384 }); @@ -55,7 +55,7 @@ onMounted(async () => { }); watch( - () => props.showCircleIds, + () => props.showCircleTranslationKeys, (newCircleIds, oldCircleIds) => { log.debug("LearningPathDiagram showCircleIds changed", newCircleIds, oldCircleIds); render(); @@ -93,15 +93,16 @@ interface CirclePie extends d3.PieArcDatum { interface InternalCircle { id: number; + translation_key: string; title: string; frontend_url: string; slug: string; pieData: CirclePie[]; } -function isCircleVisible(circleId: number) { - if (props.showCircleIds) { - return props.showCircleIds.includes(circleId); +function isCircleVisible(circleTranslationKey: string) { + if (props.showCircleTranslationKeys) { + return props.showCircleTranslationKeys.includes(circleTranslationKey); } return true; @@ -127,12 +128,13 @@ const circles = computed(() => { pie.allFinished = allFinished(circle, thisLearningSequence); }); - if (isCircleVisible(circle.id)) { + if (isCircleVisible(circle.translation_key)) { internalCircles.push({ pieData: pieData.reverse() as CirclePie[], title: circle.title, frontend_url: circle.frontend_url, id: circle.id, + translation_key: circle.translation_key, slug: _.kebabCase(circle.title), }); } @@ -196,7 +198,7 @@ function render() { .append("g") .attr("class", (internalCircle) => { let result = "circle"; - if (!isCircleVisible(internalCircle.id)) { + if (!isCircleVisible(internalCircle.translation_key)) { result += " hidden"; } return result; diff --git a/client/src/pages/cockpit/CockpitIndexPage.vue b/client/src/pages/cockpit/CockpitIndexPage.vue index 892eaf3b..35202cb2 100644 --- a/client/src/pages/cockpit/CockpitIndexPage.vue +++ b/client/src/pages/cockpit/CockpitIndexPage.vue @@ -21,7 +21,7 @@ const learningPathStore = useLearningPathStore(); function userCountStatus(userId: number) { return competenceStore.calcStatusCount( - competenceStore.flatPerformanceCriteria(userId) + competenceStore.flatPerformanceCriteria(userId, cockpitStore.selectedCircles) ); } @@ -33,8 +33,8 @@ const data = { }, }; -function setActiveClasses(id: number) { - return cockpitStore.selectedCircles.indexOf(id) > -1 +function setActiveClasses(translationKey: string) { + return cockpitStore.selectedCircles.indexOf(translationKey) > -1 ? ["bg-blue-900", "text-white"] : ["text-bg-900"]; } @@ -48,13 +48,13 @@ function setActiveClasses(id: number) {