VBV-191: Abschluss Lernsequenz
This commit is contained in:
parent
3eb6664f03
commit
07406f8e89
|
|
@ -167,14 +167,14 @@ const learningSequenceBorderClass = computed(() => {
|
||||||
@click="circleStore.openSelfEvaluation(learningUnit)"
|
@click="circleStore.openSelfEvaluation(learningUnit)"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="circleStore.calcSelfEvaluationStatus(learningUnit)"
|
v-if="circleStore.calcSelfEvaluationStatus(learningUnit) === 'success'"
|
||||||
class="flex items-center gap-4 pb-3 lg:pb-6 self-evaluation-success"
|
class="flex items-center gap-4 pb-3 lg:pb-6 self-evaluation-success"
|
||||||
>
|
>
|
||||||
<it-icon-smiley-happy class="w-8 h-8 flex-none" data-cy="success" />
|
<it-icon-smiley-happy class="w-8 h-8 flex-none" data-cy="success" />
|
||||||
<div>Selbsteinschätzung: Ich kann das.</div>
|
<div>Selbsteinschätzung: Ich kann das.</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="circleStore.calcSelfEvaluationStatus(learningUnit) === false"
|
v-else-if="circleStore.calcSelfEvaluationStatus(learningUnit) === 'fail'"
|
||||||
class="flex items-center gap-4 pb-3 lg:pb-6 self-evaluation-fail"
|
class="flex items-center gap-4 pb-3 lg:pb-6 self-evaluation-fail"
|
||||||
>
|
>
|
||||||
<it-icon-smiley-thinking class="w-8 h-8 flex-none" data-cy="fail" />
|
<it-icon-smiley-thinking class="w-8 h-8 flex-none" data-cy="fail" />
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import type {
|
||||||
LearningUnitPerformanceCriteria,
|
LearningUnitPerformanceCriteria,
|
||||||
WagtailCircle,
|
WagtailCircle,
|
||||||
} from "@/types";
|
} from "@/types";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
export function parseLearningSequences(
|
export function parseLearningSequences(
|
||||||
circle: Circle,
|
circle: Circle,
|
||||||
|
|
@ -191,17 +192,29 @@ export class Circle implements WagtailCircle {
|
||||||
|
|
||||||
public allFinishedInLearningSequence(translationKey: string): boolean {
|
public allFinishedInLearningSequence(translationKey: string): boolean {
|
||||||
if (translationKey) {
|
if (translationKey) {
|
||||||
const finishedContents = this.flatChildren.filter((lc) => {
|
const [performanceCriteria, learningContents] = _.partition(
|
||||||
return (
|
this.flatChildren.filter(
|
||||||
lc.completion_status === "success" &&
|
(lc) => lc.parentLearningSequence?.translation_key === translationKey
|
||||||
lc.parentLearningSequence?.translation_key === translationKey
|
),
|
||||||
);
|
function (child) {
|
||||||
}).length;
|
return child.type === "competence.PerformanceCriteria";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const totalContents = this.flatChildren.filter((lc) => {
|
const groupedPerformanceCriteria = _.values(
|
||||||
return lc.parentLearningSequence?.translation_key === translationKey;
|
_.groupBy(performanceCriteria, (pc) => pc.parentLearningUnit?.id)
|
||||||
}).length;
|
);
|
||||||
return finishedContents === totalContents;
|
|
||||||
|
return (
|
||||||
|
learningContents.every((lc) => lc.completion_status === "success") &&
|
||||||
|
(groupedPerformanceCriteria.length === 0 ||
|
||||||
|
groupedPerformanceCriteria.every((group) =>
|
||||||
|
group.some(
|
||||||
|
(pc) =>
|
||||||
|
pc.completion_status === "success" || pc.completion_status === "fail"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -130,16 +130,16 @@ export const useCircleStore = defineStore({
|
||||||
hash: createLearningUnitHash(learningUnit),
|
hash: createLearningUnitHash(learningUnit),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
calcSelfEvaluationStatus(learningUnit: LearningUnit) {
|
calcSelfEvaluationStatus(learningUnit: LearningUnit): CourseCompletionStatus {
|
||||||
if (learningUnit.children.length > 0) {
|
if (learningUnit.children.length > 0) {
|
||||||
if (learningUnit.children.every((q) => q.completion_status === "success")) {
|
if (learningUnit.children.every((q) => q.completion_status === "success")) {
|
||||||
return true;
|
return "success";
|
||||||
}
|
}
|
||||||
if (learningUnit.children.some((q) => q.completion_status === "fail")) {
|
if (learningUnit.children.some((q) => q.completion_status === "fail")) {
|
||||||
return false;
|
return "fail";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return "unknown";
|
||||||
},
|
},
|
||||||
continueFromLearningContent(currentLearningContent: LearningContent) {
|
continueFromLearningContent(currentLearningContent: LearningContent) {
|
||||||
if (currentLearningContent) {
|
if (currentLearningContent) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue