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