poc: feedback - abgabe step for if MENTOR_FEEDBACK

This commit is contained in:
Livio Bieri 2024-01-17 17:41:29 +01:00
parent 359d4482a4
commit 9a601e0169
6 changed files with 66 additions and 26 deletions

View File

@ -3,7 +3,7 @@ import { useCircleStore } from "@/stores/circle";
import type { CircleType, LearningUnit } from "@/types"; import type { CircleType, LearningUnit } from "@/types";
import * as log from "loglevel"; import * as log from "loglevel";
import { useCurrentCourseSession, useCourseDataWithCompletion } from "@/composables"; import { useCourseDataWithCompletion, useCurrentCourseSession } from "@/composables";
import LearningContentContainer from "@/pages/learningPath/learningContentPage/LearningContentContainer.vue"; import LearningContentContainer from "@/pages/learningPath/learningContentPage/LearningContentContainer.vue";
import LearningContentMultiLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentMultiLayout.vue"; import LearningContentMultiLayout from "@/pages/learningPath/learningContentPage/layouts/LearningContentMultiLayout.vue";
import eventBus from "@/utils/eventBus"; import eventBus from "@/utils/eventBus";
@ -26,20 +26,32 @@ const props = defineProps<{
circle: CircleType; circle: CircleType;
}>(); }>();
const learningUnitHasFeedbackPage = computed(
() => props.learningUnit?.feedback_user !== "NO_FEEDBACK"
);
const questions = computed(() => props.learningUnit?.performance_criteria ?? []); 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 currentQuestion = computed(() => questions.value[questionIndex.value]);
const showPreviousButton = computed(() => questionIndex.value != 0); const showPreviousButton = computed(() => questionIndex.value != 0);
const showNextButton = computed( const showNextButton = computed(
() => questionIndex.value + 1 < questions.value?.length && questions.value?.length > 1 () => questionIndex.value + 1 < numPages.value && numPages.value > 1
); );
const showExitButton = computed( const showExitButton = computed(
() => () => questions.value?.length === 1 || numPages.value == questionIndex.value + 1
questions.value?.length === 1 || questions.value?.length === questionIndex.value + 1
); );
function handleContinue() { function handleContinue() {
log.debug("handleContinue"); log.debug("handleContinue");
if (questionIndex.value + 1 < questions.value.length) { if (questionIndex.value + 1 < numPages.value) {
log.debug("increment questionIndex", questionIndex.value); log.debug("increment questionIndex", questionIndex.value);
questionIndex.value += 1; questionIndex.value += 1;
} else { } else {
@ -50,7 +62,7 @@ function handleContinue() {
function handleBack() { function handleBack() {
log.debug("handleBack"); log.debug("handleBack");
if (questionIndex.value > 0 && questionIndex.value < questions.value.length) { if (questionIndex.value > 0 && questionIndex.value < numPages.value) {
questionIndex.value -= 1; questionIndex.value -= 1;
} }
} }
@ -78,16 +90,19 @@ onUnmounted(() => {
:sub-title="$t('a.Selbsteinschätzung')" :sub-title="$t('a.Selbsteinschätzung')"
:title="`${learningUnit.title}`" :title="`${learningUnit.title}`"
icon="it-icon-lc-learning-module" icon="it-icon-lc-learning-module"
:steps-count="questions.length" :steps-count="numPages"
:show-next-button="showNextButton" :show-next-button="showNextButton"
:show-exit-button="showExitButton" :show-exit-button="showExitButton"
:show-start-button="false" :show-start-button="false"
:show-previous-button="showPreviousButton" :show-previous-button="showPreviousButton"
:base-url="props.learningUnit.evaluate_url" :base-url="props.learningUnit.evaluate_url"
:end-badge-text="
learningUnitHasFeedbackPage ? $t('general.submission') : undefined
"
@previous="handleBack()" @previous="handleBack()"
@next="handleContinue()" @next="handleContinue()"
> >
<div class="h-full"> <div v-if="currentQuestion" class="h-full">
<div class="mt-8"> <div class="mt-8">
<h3 class="heading-3"> <h3 class="heading-3">
{{ currentQuestion.title }} {{ currentQuestion.title }}
@ -137,6 +152,9 @@ onUnmounted(() => {
</div> </div>
</div> </div>
</div> </div>
<div v-else>
<span>Sali zeme, Abgooob</span>
</div>
</LearningContentMultiLayout> </LearningContentMultiLayout>
</LearningContentContainer> </LearningContentContainer>
</div> </div>

View File

@ -15,9 +15,7 @@ const props = defineProps<{
const courseData = useCourseDataWithCompletion(props.courseSlug); const courseData = useCourseDataWithCompletion(props.courseSlug);
const learningUnit = computed(() => { const learningUnit = computed(() => {
const lu = courseData.findLearningUnit(props.learningUnitSlug, props.circleSlug); return courseData.findLearningUnit(props.learningUnitSlug, props.circleSlug);
console.log("FEEDBACK_USER", lu?.feedback_user);
return lu;
}); });
const circle = computed(() => { const circle = computed(() => {
return courseData.findCircle(props.circleSlug); return courseData.findCircle(props.circleSlug);

View File

@ -6,9 +6,9 @@ from wagtail_localize.models import LocaleSynchronization
from vbv_lernwelt.assignment.models import Assignment from vbv_lernwelt.assignment.models import Assignment
from vbv_lernwelt.competence.factories import ( from vbv_lernwelt.competence.factories import (
PerformanceCriteriaFactory,
ActionCompetenceFactory, ActionCompetenceFactory,
ActionCompetenceListPageFactory, ActionCompetenceListPageFactory,
PerformanceCriteriaFactory,
) )
from vbv_lernwelt.competence.models import ActionCompetence from vbv_lernwelt.competence.models import ActionCompetence
from vbv_lernwelt.core.admin import User from vbv_lernwelt.core.admin import User

View File

@ -4,20 +4,38 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('learnpath', '0012_auto_20231129_0827'), ("learnpath", "0012_auto_20231129_0827"),
] ]
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name='learningunit', model_name="learningunit",
name='feedback_user', name="feedback_user",
field=models.CharField(blank=True, choices=[('NO_FEEDBACK', 'NO_FEEDBACK'), ('MENTOR_FEEDBACK', 'MENTOR_FEEDBACK')], default='NO_FEEDBACK', max_length=255), field=models.CharField(
blank=True,
choices=[
("NO_FEEDBACK", "NO_FEEDBACK"),
("MENTOR_FEEDBACK", "MENTOR_FEEDBACK"),
],
default="NO_FEEDBACK",
max_length=255,
),
), ),
migrations.AlterField( migrations.AlterField(
model_name='learningcontentassignment', model_name="learningcontentassignment",
name='assignment_type', 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), 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,
),
), ),
] ]

View File

@ -4,15 +4,21 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('learnpath', '0013_auto_20240117_1400'), ("learnpath", "0013_auto_20240117_1400"),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='learningunit', model_name="learningunit",
name='feedback_user', name="feedback_user",
field=models.CharField(choices=[('NO_FEEDBACK', 'NO_FEEDBACK'), ('MENTOR_FEEDBACK', 'MENTOR_FEEDBACK')], default='NO_FEEDBACK', max_length=255), field=models.CharField(
choices=[
("NO_FEEDBACK", "NO_FEEDBACK"),
("MENTOR_FEEDBACK", "MENTOR_FEEDBACK"),
],
default="NO_FEEDBACK",
max_length=255,
),
), ),
] ]

View File

@ -3,7 +3,7 @@ from enum import Enum
from django.db import models from django.db import models
from django.utils.text import slugify 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.fields import RichTextField, StreamField
from wagtail.models import Page from wagtail.models import Page