From 9a601e01693c624f853182085490d630bba6ede7 Mon Sep 17 00:00:00 2001 From: Livio Bieri Date: Wed, 17 Jan 2024 17:41:29 +0100 Subject: [PATCH] poc: feedback - abgabe step for if MENTOR_FEEDBACK --- .../selfEvaluationPage/SelfEvaluation.vue | 34 ++++++++++++++----- .../selfEvaluationPage/SelfEvaluationPage.vue | 4 +-- .../learnpath/create_vv_new_learning_path.py | 2 +- .../migrations/0013_auto_20240117_1400.py | 34 ++++++++++++++----- .../0014_alter_learningunit_feedback_user.py | 16 ++++++--- server/vbv_lernwelt/learnpath/models.py | 2 +- 6 files changed, 66 insertions(+), 26 deletions(-) diff --git a/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluation.vue b/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluation.vue index 4a5b8c9a..e7a62386 100644 --- a/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluation.vue +++ b/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluation.vue @@ -3,7 +3,7 @@ import { useCircleStore } from "@/stores/circle"; import type { CircleType, LearningUnit } from "@/types"; import * as log from "loglevel"; -import { useCurrentCourseSession, useCourseDataWithCompletion } from "@/composables"; +import { useCourseDataWithCompletion, useCurrentCourseSession } from "@/composables"; import LearningContentContainer from "@/pages/learningPath/learningContentPage/LearningContentContainer.vue"; import LearningContentMultiLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentMultiLayout.vue"; import eventBus from "@/utils/eventBus"; @@ -26,20 +26,32 @@ const props = defineProps<{ circle: CircleType; }>(); +const learningUnitHasFeedbackPage = computed( + () => props.learningUnit?.feedback_user !== "NO_FEEDBACK" +); + const questions = computed(() => props.learningUnit?.performance_criteria ?? []); + +const numPages = computed(() => { + if (learningUnitHasFeedbackPage.value) { + return questions.value.length + 1; + } else { + return questions.value.length; + } +}); + const currentQuestion = computed(() => questions.value[questionIndex.value]); const showPreviousButton = computed(() => questionIndex.value != 0); const showNextButton = computed( - () => questionIndex.value + 1 < questions.value?.length && questions.value?.length > 1 + () => questionIndex.value + 1 < numPages.value && numPages.value > 1 ); const showExitButton = computed( - () => - questions.value?.length === 1 || questions.value?.length === questionIndex.value + 1 + () => questions.value?.length === 1 || numPages.value == questionIndex.value + 1 ); function handleContinue() { log.debug("handleContinue"); - if (questionIndex.value + 1 < questions.value.length) { + if (questionIndex.value + 1 < numPages.value) { log.debug("increment questionIndex", questionIndex.value); questionIndex.value += 1; } else { @@ -50,7 +62,7 @@ function handleContinue() { function handleBack() { log.debug("handleBack"); - if (questionIndex.value > 0 && questionIndex.value < questions.value.length) { + if (questionIndex.value > 0 && questionIndex.value < numPages.value) { questionIndex.value -= 1; } } @@ -78,16 +90,19 @@ onUnmounted(() => { :sub-title="$t('a.Selbsteinschätzung')" :title="`${learningUnit.title}`" icon="it-icon-lc-learning-module" - :steps-count="questions.length" + :steps-count="numPages" :show-next-button="showNextButton" :show-exit-button="showExitButton" :show-start-button="false" :show-previous-button="showPreviousButton" :base-url="props.learningUnit.evaluate_url" + :end-badge-text=" + learningUnitHasFeedbackPage ? $t('general.submission') : undefined + " @previous="handleBack()" @next="handleContinue()" > -
+

{{ currentQuestion.title }} @@ -137,6 +152,9 @@ onUnmounted(() => {

+
+ Sali zeme, Abgooob +
diff --git a/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluationPage.vue b/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluationPage.vue index 30d2f98d..2c55f468 100644 --- a/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluationPage.vue +++ b/client/src/pages/learningPath/selfEvaluationPage/SelfEvaluationPage.vue @@ -15,9 +15,7 @@ const props = defineProps<{ const courseData = useCourseDataWithCompletion(props.courseSlug); const learningUnit = computed(() => { - const lu = courseData.findLearningUnit(props.learningUnitSlug, props.circleSlug); - console.log("FEEDBACK_USER", lu?.feedback_user); - return lu; + return courseData.findLearningUnit(props.learningUnitSlug, props.circleSlug); }); const circle = computed(() => { return courseData.findCircle(props.circleSlug); diff --git a/server/vbv_lernwelt/learnpath/create_vv_new_learning_path.py b/server/vbv_lernwelt/learnpath/create_vv_new_learning_path.py index 6a7656ea..0cb82ab4 100644 --- a/server/vbv_lernwelt/learnpath/create_vv_new_learning_path.py +++ b/server/vbv_lernwelt/learnpath/create_vv_new_learning_path.py @@ -6,9 +6,9 @@ from wagtail_localize.models import LocaleSynchronization from vbv_lernwelt.assignment.models import Assignment from vbv_lernwelt.competence.factories import ( - PerformanceCriteriaFactory, ActionCompetenceFactory, ActionCompetenceListPageFactory, + PerformanceCriteriaFactory, ) from vbv_lernwelt.competence.models import ActionCompetence from vbv_lernwelt.core.admin import User diff --git a/server/vbv_lernwelt/learnpath/migrations/0013_auto_20240117_1400.py b/server/vbv_lernwelt/learnpath/migrations/0013_auto_20240117_1400.py index 3b78bfbc..b8a11cb8 100644 --- a/server/vbv_lernwelt/learnpath/migrations/0013_auto_20240117_1400.py +++ b/server/vbv_lernwelt/learnpath/migrations/0013_auto_20240117_1400.py @@ -4,20 +4,38 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('learnpath', '0012_auto_20231129_0827'), + ("learnpath", "0012_auto_20231129_0827"), ] operations = [ migrations.AddField( - model_name='learningunit', - name='feedback_user', - field=models.CharField(blank=True, choices=[('NO_FEEDBACK', 'NO_FEEDBACK'), ('MENTOR_FEEDBACK', 'MENTOR_FEEDBACK')], default='NO_FEEDBACK', max_length=255), + model_name="learningunit", + name="feedback_user", + field=models.CharField( + blank=True, + choices=[ + ("NO_FEEDBACK", "NO_FEEDBACK"), + ("MENTOR_FEEDBACK", "MENTOR_FEEDBACK"), + ], + default="NO_FEEDBACK", + max_length=255, + ), ), migrations.AlterField( - model_name='learningcontentassignment', - name='assignment_type', - field=models.CharField(choices=[('PRAXIS_ASSIGNMENT', 'PRAXIS_ASSIGNMENT'), ('CASEWORK', 'CASEWORK'), ('PREP_ASSIGNMENT', 'PREP_ASSIGNMENT'), ('REFLECTION', 'REFLECTION'), ('CONDITION_ACCEPTANCE', 'CONDITION_ACCEPTANCE'), ('EDONIQ_TEST', 'EDONIQ_TEST')], default='CASEWORK', max_length=50), + model_name="learningcontentassignment", + name="assignment_type", + field=models.CharField( + choices=[ + ("PRAXIS_ASSIGNMENT", "PRAXIS_ASSIGNMENT"), + ("CASEWORK", "CASEWORK"), + ("PREP_ASSIGNMENT", "PREP_ASSIGNMENT"), + ("REFLECTION", "REFLECTION"), + ("CONDITION_ACCEPTANCE", "CONDITION_ACCEPTANCE"), + ("EDONIQ_TEST", "EDONIQ_TEST"), + ], + default="CASEWORK", + max_length=50, + ), ), ] diff --git a/server/vbv_lernwelt/learnpath/migrations/0014_alter_learningunit_feedback_user.py b/server/vbv_lernwelt/learnpath/migrations/0014_alter_learningunit_feedback_user.py index a75d2090..91dd1d39 100644 --- a/server/vbv_lernwelt/learnpath/migrations/0014_alter_learningunit_feedback_user.py +++ b/server/vbv_lernwelt/learnpath/migrations/0014_alter_learningunit_feedback_user.py @@ -4,15 +4,21 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('learnpath', '0013_auto_20240117_1400'), + ("learnpath", "0013_auto_20240117_1400"), ] operations = [ migrations.AlterField( - model_name='learningunit', - name='feedback_user', - field=models.CharField(choices=[('NO_FEEDBACK', 'NO_FEEDBACK'), ('MENTOR_FEEDBACK', 'MENTOR_FEEDBACK')], default='NO_FEEDBACK', max_length=255), + model_name="learningunit", + name="feedback_user", + field=models.CharField( + choices=[ + ("NO_FEEDBACK", "NO_FEEDBACK"), + ("MENTOR_FEEDBACK", "MENTOR_FEEDBACK"), + ], + default="NO_FEEDBACK", + max_length=255, + ), ), ] diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py index 26b5b164..6f1d95f0 100644 --- a/server/vbv_lernwelt/learnpath/models.py +++ b/server/vbv_lernwelt/learnpath/models.py @@ -3,7 +3,7 @@ from enum import Enum from django.db import models from django.utils.text import slugify -from wagtail.admin.panels import FieldPanel, PageChooserPanel, HelpPanel +from wagtail.admin.panels import FieldPanel, HelpPanel, PageChooserPanel from wagtail.fields import RichTextField, StreamField from wagtail.models import Page