Fix problem

This commit is contained in:
Daniel Egger 2022-06-20 09:19:51 +02:00
parent a27fa35fe3
commit bf9cc37a2f
2 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,4 @@
<script setup lang="ts">
import ItCheckbox from '@/components/ui/ItCheckbox.vue';
const props = defineProps(['learningSequence', 'completionData'])
@ -9,7 +7,7 @@ const contentCompleted = (learningContent) => {
if (props.completionData?.completed_learning_contents) {
return props.completionData.completed_learning_contents.findIndex((e) => {
return e.learning_content_key === learningContent.translation_key && e.completed;
}) > 0;
}) >= 0;
}
return false;

View File

@ -25,11 +25,12 @@ export default {
learning_content_key: learningContent.translation_key,
completed: completed,
}).then((data) => {
log.warn(data);
this.completionData = data;
});
},
createLearningSequences(circleData) {
// aggregate wagtail data into LearningSequence > LearningUnit > LearningPackage hierarchy
// aggregate wagtail data into LearningSequence > LearningUnit > LearningContent hierarchy
let learningSequence = null;
let learningUnit = null;
circleData.children.forEach((child) => {
@ -41,13 +42,13 @@ export default {
}
this.learningSequences.push(learningSequence);
}
learningSequence = Object.assign(child, { learningUnits: [] });
learningSequence = Object.assign({}, child, { learningUnits: [] });
learningUnit = { id: null, title: '', learningContents: [] };
} else if(child.type === 'learnpath.LearningUnit') {
if(learningUnit && learningUnit.learningContents.length) {
learningSequence.learningUnits.push(learningUnit);
}
learningUnit = Object.assign(child, { learningContents: [] });
learningUnit = Object.assign({}, child, { learningContents: [] });
} else {
learningUnit.learningContents.push(child);
}