fix: apply new definition of completed to allFinishedInLearningSequence
This commit is contained in:
parent
3573a6f54b
commit
1831dcc363
|
|
@ -43,10 +43,26 @@ export function someFinishedInLearningSequence(ls: LearningSequence) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completed is defined as having completed all learning contents,
|
||||||
|
* ranked at least one performance criteria (but not necessarily all)
|
||||||
|
* was ranked as success or fail.
|
||||||
|
*/
|
||||||
export function allFinishedInLearningSequence(ls: LearningSequence) {
|
export function allFinishedInLearningSequence(ls: LearningSequence) {
|
||||||
return learningSequenceFlatChildren(ls).every((lc) => {
|
const allLearningContentsCompleted = ls.learning_units
|
||||||
return lc.completion_status === "SUCCESS";
|
.flatMap((lu) => lu.learning_contents)
|
||||||
});
|
.every((lc) => lc.completion_status === "SUCCESS");
|
||||||
|
|
||||||
|
const performanceCriteria = ls.learning_units.flatMap(
|
||||||
|
(lu) => lu.performance_criteria
|
||||||
|
);
|
||||||
|
|
||||||
|
const somePerformanceCriteriaRanked =
|
||||||
|
performanceCriteria.some((pc) => pc.completion_status === "SUCCESS") ||
|
||||||
|
performanceCriteria.some((pc) => pc.completion_status === "FAIL") ||
|
||||||
|
performanceCriteria.length === 0;
|
||||||
|
|
||||||
|
return allLearningContentsCompleted && somePerformanceCriteriaRanked;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function performanceCriteriaStatusCount(
|
export function performanceCriteriaStatusCount(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue