diff --git a/client/src/components/circle/LearningContent.vue b/client/src/components/circle/LearningContent.vue index 1c7dfaa8..67b9fc2b 100644 --- a/client/src/components/circle/LearningContent.vue +++ b/client/src/components/circle/LearningContent.vue @@ -41,7 +41,7 @@ const block = computed(() => { diff --git a/client/src/components/circle/LearningSequence.vue b/client/src/components/circle/LearningSequence.vue index 92cd2d39..91c2b5c5 100644 --- a/client/src/components/circle/LearningSequence.vue +++ b/client/src/components/circle/LearningSequence.vue @@ -46,7 +46,7 @@ const someFinished = computed(() => {
{{ learningUnit.title }}
@@ -94,7 +94,7 @@ const someFinished = computed(() => {
-
+
diff --git a/client/src/components/circle/SelfEvaluation.vue b/client/src/components/circle/SelfEvaluation.vue index 0c9139f2..6b2c7999 100644 --- a/client/src/components/circle/SelfEvaluation.vue +++ b/client/src/components/circle/SelfEvaluation.vue @@ -1,15 +1,29 @@ @@ -37,7 +51,7 @@ const currentQuestion = computed(() => questions.value[questionIndex]); @@ -46,7 +60,7 @@ const currentQuestion = computed(() => questions.value[questionIndex]);
-
Schritt {{ questionIndex + 1 }} von {{ questions.length }}
+
Schritt {{ state.questionIndex + 1 }} von {{ questions.length }}

Überprüfe, ob du in der Lernheinheit "{{ circleStore.currentSelfEvaluation.title }}" alles verstanden hast.
diff --git a/client/src/services/circle.ts b/client/src/services/circle.ts index 9e686b2b..9c0178ce 100644 --- a/client/src/services/circle.ts +++ b/client/src/services/circle.ts @@ -12,6 +12,7 @@ function createEmptyLearningUnit(parentLearningSequence: LearningSequence): Lear minutes: 0, parentLearningSequence: parentLearningSequence, children: [], + last: true, }; } @@ -26,6 +27,7 @@ export function parseLearningSequences (children: CircleChild[]): LearningSequen if (child.type === 'learnpath.LearningSequence') { if (learningSequence) { if (learningUnit) { + learningUnit.last = true; learningSequence.learningUnits.push(learningUnit); } result.push(learningSequence); @@ -74,6 +76,7 @@ export function parseLearningSequences (children: CircleChild[]): LearningSequen if (learningUnit && learningSequence) { // TypeScript does not get it here... + learningUnit.last = true; (learningSequence as LearningSequence).learningUnits.push(learningUnit); result.push(learningSequence); } else { diff --git a/client/src/stores/circle.ts b/client/src/stores/circle.ts index df1d443a..557c297c 100644 --- a/client/src/stores/circle.ts +++ b/client/src/stores/circle.ts @@ -104,17 +104,42 @@ export const useCircleStore = defineStore({ } } return undefined; - } - , - continueToNextLearningContent() { + }, + continueFromLearningContent() { if (this.currentLearningContent) { this.markCompletion(this.currentLearningContent, true); - if (this.currentLearningContent.nextLearningContent) { + + const nextLearningContent = this.currentLearningContent.nextLearningContent; + const currentParent = this.currentLearningContent.parentLearningUnit; + const nextParent = nextLearningContent?.parentLearningUnit; + + if ( + currentParent && currentParent.id && + currentParent.id !== nextParent?.id && + currentParent.children.length > 0 + ) { + // go to self evaluation + this.openSelfEvaluation(currentParent); + } else if (this.currentLearningContent.nextLearningContent) { this.openLearningContent(this.currentLearningContent.nextLearningContent); + } else { + this.closeLearningContent(); } } else { log.error('currentLearningContent is undefined'); } + }, + continueFromSelfEvaluation() { + if (this.currentSelfEvaluation) { + const nextContent = this.currentSelfEvaluation.learningContents[this.currentSelfEvaluation.learningContents.length - 1].nextLearningContent; + if (nextContent) { + this.openLearningContent(nextContent); + } else { + this.closeSelfEvaluation(); + } + } else { + log.error('currentSelfEvaluation is undefined'); + } } } }) diff --git a/client/src/types.ts b/client/src/types.ts index 2e4b172a..265f9974 100644 --- a/client/src/types.ts +++ b/client/src/types.ts @@ -75,6 +75,7 @@ export interface LearningUnit extends LearningWagtailPage { minutes: number; parentLearningSequence?: LearningSequence; children: LearningUnitQuestion[]; + last?: boolean; } export interface LearningSequence extends LearningWagtailPage { diff --git a/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py b/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py index 574d2c55..027ff483 100644 --- a/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py +++ b/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py @@ -114,6 +114,10 @@ Fachspezialisten bei. title="Ich bin in der Lage, mit geeigneten Fragestellungen die Deckung von Versicherungen zu erfassen.", parent=lu ) + LearningUnitQuestionFactory( + title="Zweite passende Frage zu 'Absicherung der Familie'", + parent=lu + ) LearningContentFactory( title='Ermittlung des Kundenbedarfs', parent=circe_analyse, @@ -137,7 +141,11 @@ Fachspezialisten bei. ) LearningSequenceFactory(title='Anwenden', parent=circe_analyse, icon='it-icon-ls-apply') - LearningUnitFactory(title='Prämien einsparen', parent=circe_analyse) + lu = LearningUnitFactory(title='Prämien einsparen', parent=circe_analyse) + LearningUnitQuestionFactory( + title="Passende Frage zu Anwenden", + parent=lu + ) LearningContentFactory( title='Versicherungsbedarf für Familien', parent=circe_analyse, @@ -151,7 +159,11 @@ Fachspezialisten bei. contents=[('exercise', ExerciseBlockFactory())] ) - LearningUnitFactory(title='Sich selbständig machen', parent=circe_analyse) + lu = LearningUnitFactory(title='Sich selbständig machen', parent=circe_analyse) + LearningUnitQuestionFactory( + title="Passende Frage zu 'Sich selbständig machen'", + parent=lu + ) LearningContentFactory( title='GmbH oder AG', parent=circe_analyse, @@ -165,7 +177,11 @@ Fachspezialisten bei. contents=[('exercise', ExerciseBlockFactory())] ) - LearningUnitFactory(title='Auto verkaufen', parent=circe_analyse) + lu = LearningUnitFactory(title='Auto verkaufen', parent=circe_analyse) + LearningUnitQuestionFactory( + title='Passende Frage zu "Auto verkaufen"', + parent=lu + ) LearningContentFactory( title='Motorfahrzeugversicherung', parent=circe_analyse, @@ -192,7 +208,11 @@ Fachspezialisten bei. ) LearningSequenceFactory(title='Üben', parent=circe_analyse, icon='it-icon-ls-practice') - LearningUnitFactory(title='Kind zieht von zu Hause aus', parent=circe_analyse) + lu = LearningUnitFactory(title='Kind zieht von zu Hause aus', parent=circe_analyse) + LearningUnitQuestionFactory( + title='Passende Frage zu "Kind zieht von zu Hause aus"', + parent=lu + ) LearningContentFactory( title='Hausrat', parent=circe_analyse,