diff --git a/kolibri/core/assets/src/exams/utils.js b/kolibri/core/assets/src/exams/utils.js index 81baf436853..367bef2aafd 100644 --- a/kolibri/core/assets/src/exams/utils.js +++ b/kolibri/core/assets/src/exams/utils.js @@ -263,7 +263,7 @@ export function annotateSections(sections, questions = []) { if (!sections) { return [ { - title: '', + section_title: '', questions: questions, startQuestionNumber: 0, endQuestionNumber: questions.length - 1, diff --git a/kolibri/core/assets/src/views/AttemptLogItem.vue b/kolibri/core/assets/src/views/AttemptLogItem.vue index e61b7179733..46a57aca77c 100644 --- a/kolibri/core/assets/src/views/AttemptLogItem.vue +++ b/kolibri/core/assets/src/views/AttemptLogItem.vue @@ -5,7 +5,7 @@ :is="displayTag" class="item" > - {{ coreString('questionNumberLabel', { questionNumber: attemptLog.questionNumber }) }} + {{ coreString('questionNumberLabel', { questionNumber: questionNumber }) }} @@ -131,8 +134,10 @@ " > @@ -193,10 +198,17 @@ return sections.value[currentSectionIndex.value]; }); + // Computed property for attempt logs of the current section + const attemptLogsForCurrentSection = computed(() => { + const start = currentSection.value.startQuestionNumber; + return props.attemptLogs.slice(start, start + currentSection.value.questions.length); + }); + const questionSelectOptions = computed(() => { return currentSection.value.questions.map((question, index) => ({ value: index, label: questionNumberLabel$({ questionNumber: index + 1 }), + disabled: !attemptLogsForCurrentSection.value[index], })); }); @@ -212,6 +224,11 @@ ]; }); + // Computed property for the selected attempt log + const selectedAttemptLog = computed(() => { + return props.attemptLogs[selectedQuestionNumber.value]; + }); + function handleQuestionChange(index) { emit('select', index + currentSection.value.startQuestionNumber); expandCurrentSectionIfNeeded(); @@ -239,6 +256,8 @@ sectionSelectOptions, selectedQuestion, questionSelectOptions, + attemptLogsForCurrentSection, + selectedAttemptLog, }; }, props: {