From 1df19758deec4ff455975e8b464b6cc4bae09d97 Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Fri, 18 Oct 2024 10:32:35 -0500
Subject: [PATCH 1/4] Update how the attemptLog for the current section and
mobile selection options are computed
---
.../core/assets/src/views/AttemptLogList.vue | 38 +++++++++++++++----
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/kolibri/core/assets/src/views/AttemptLogList.vue b/kolibri/core/assets/src/views/AttemptLogList.vue
index 8384f05a441..47ed87c8115 100644
--- a/kolibri/core/assets/src/views/AttemptLogList.vue
+++ b/kolibri/core/assets/src/views/AttemptLogList.vue
@@ -38,15 +38,16 @@
@@ -62,7 +63,7 @@
v-for="(section, index) in sections"
:id="`section-questions-${index}`"
:key="`section-questions-${index}`"
- :title="displaySectionTitle(section, index)"
+ :title="displaySectionTitle(section, index) || ''"
@focus="expand(index)"
>
@@ -193,11 +195,24 @@
return sections.value[currentSectionIndex.value];
});
+ // Computed property for attempt logs of the current section
+ const attemptLogsForCurrentSection = computed(() => {
+ const start = currentSection.value.startQuestionNumber;
+ return currentSection.value.questions.map((_, index) => {
+ return props.attemptLogs[start + index];
+ });
+ });
+
const questionSelectOptions = computed(() => {
- return currentSection.value.questions.map((question, index) => ({
- value: index,
- label: questionNumberLabel$({ questionNumber: index + 1 }),
- }));
+ return currentSection.value.questions.reduce((options, question, index) => {
+ if (attemptLogsForCurrentSection.value[index]) {
+ options.push({
+ value: index,
+ label: questionNumberLabel$({ questionNumber: index + 1 }),
+ });
+ }
+ return options;
+ }, []);
});
// The KSelect-shaped object for the current section
@@ -212,6 +227,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 +259,8 @@
sectionSelectOptions,
selectedQuestion,
questionSelectOptions,
+ attemptLogsForCurrentSection,
+ selectedAttemptLog,
};
},
props: {
From 110070ac9db868c78853de1aadfaf66e70879069 Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Mon, 21 Oct 2024 11:05:40 -0500
Subject: [PATCH 2/4] Display section number instead of empty string if section
title is undefined
---
kolibri/core/assets/src/views/AttemptLogList.vue | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kolibri/core/assets/src/views/AttemptLogList.vue b/kolibri/core/assets/src/views/AttemptLogList.vue
index 47ed87c8115..2c083213dad 100644
--- a/kolibri/core/assets/src/views/AttemptLogList.vue
+++ b/kolibri/core/assets/src/views/AttemptLogList.vue
@@ -63,7 +63,7 @@
v-for="(section, index) in sections"
:id="`section-questions-${index}`"
:key="`section-questions-${index}`"
- :title="displaySectionTitle(section, index) || ''"
+ :title="displaySectionTitle(section, index) || sectionLabel$({ sectionNumber: index + 1 })"
@focus="expand(index)"
>
Date: Tue, 22 Oct 2024 09:23:59 -0500
Subject: [PATCH 3/4] Show all KSelect question number options in
AttemptLoglist
---
.../core/assets/src/views/AttemptLogItem.vue | 6 +++++-
.../core/assets/src/views/AttemptLogList.vue | 21 ++++++++-----------
2 files changed, 14 insertions(+), 13 deletions(-)
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 }) }}
@@ -48,6 +49,7 @@
class="attempt-option"
:isSurvey="isSurvey"
:attemptLog="attemptLogsForCurrentSection[index]"
+ :questionNumber="index + 1"
displayTag="span"
/>
@@ -135,6 +137,7 @@
v-if="attemptLogsForCurrentSection[qIndex]"
:isSurvey="isSurvey"
:attemptLog="attemptLogsForCurrentSection[qIndex]"
+ :questionNumber="qIndex + 1"
displayTag="p"
/>
@@ -198,21 +201,15 @@
// Computed property for attempt logs of the current section
const attemptLogsForCurrentSection = computed(() => {
const start = currentSection.value.startQuestionNumber;
- return currentSection.value.questions.map((_, index) => {
- return props.attemptLogs[start + index];
- });
+ return props.attemptLogs.slice(start, start + currentSection.value.questions.length);
});
const questionSelectOptions = computed(() => {
- return currentSection.value.questions.reduce((options, question, index) => {
- if (attemptLogsForCurrentSection.value[index]) {
- options.push({
- value: index,
- label: questionNumberLabel$({ questionNumber: index + 1 }),
- });
- }
- return options;
- }, []);
+ return currentSection.value.questions.map((question, index) => ({
+ value: index,
+ label: questionNumberLabel$({ questionNumber: index + 1 }),
+ disabled: !attemptLogsForCurrentSection.value[index],
+ }));
});
// The KSelect-shaped object for the current section
From 6b19bea0398e23856ed710495797d9eccda58c3c Mon Sep 17 00:00:00 2001
From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com>
Date: Wed, 23 Oct 2024 08:41:38 -0500
Subject: [PATCH 4/4] Add section_title field to annotateSections() func
---
kolibri/core/assets/src/exams/utils.js | 2 +-
kolibri/core/assets/src/views/AttemptLogList.vue | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
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/AttemptLogList.vue b/kolibri/core/assets/src/views/AttemptLogList.vue
index 4610fc7b691..25d354690a7 100644
--- a/kolibri/core/assets/src/views/AttemptLogList.vue
+++ b/kolibri/core/assets/src/views/AttemptLogList.vue
@@ -65,7 +65,7 @@
v-for="(section, index) in sections"
:id="`section-questions-${index}`"
:key="`section-questions-${index}`"
- :title="displaySectionTitle(section, index) || sectionLabel$({ sectionNumber: index + 1 })"
+ :title="displaySectionTitle(section, index)"
@focus="expand(index)"
>