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

View File

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