From 951f2ba4aff63383dcb1425181ae7da1341ce132 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Tue, 18 Jun 2024 19:22:28 -0400 Subject: [PATCH 01/23] First pass string updates following UX writing and ditto review --- .../strings/enhancedQuizManagementStrings.js | 69 +++++++++---------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index 13a1ae11305..e47e9c71196 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -18,7 +18,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: 'Quiz title', }, addQuizSections: { - message: 'Add one or more sections to the quiz, according to your needs', + message: 'Add one or more sections, according to your needs', }, addSectionLabel: { message: 'Add section', @@ -48,7 +48,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: 'Section title', }, sectionTitleUniqueWarning: { - message: 'Section titles must be unique within the quiz', + message: 'Section title already used', context: 'Informs the user that they must use a unique title for each section', }, numberOfQuestionsLabel: { @@ -76,7 +76,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: 'Add { count, number } { count, plural, one { question } other { questions }}', }, selectResourcesDescription: { - message: 'Select resources to add questions to this section', + message: "Add questions to '{ sectionTitle }'", }, numberOfSelectedBookmarks: { message: '{ count, number } { count, plural, one { bookmark } other { bookmarks }}', @@ -85,21 +85,18 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: '{count, number} {count, plural, one {question selected} other {questions selected}}', }, maxNumberOfQuestions: { - message: 'Max { count, number } { count, plural, one { question } other { questions }}', + message: 'Maximum number of questions is 50', }, maxNumberOfQuestionsPerSection: { message: 'Each section may only contain up to { count, number } { count, plural, one { question} other { questions}}, this section has { current, number }', }, replaceQuestions: { - message: 'Replace questions', + message: 'Replace questions in { sectionTitle }', }, changeResources: { message: 'Change resources', }, - questionList: { - message: 'Question list', - }, addAnswer: { message: 'Add answer', }, @@ -163,7 +160,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: 'Review selected resources', }, deleteConfirmation: { - message: "Are you sure you want to delete section '{section_title}'?", + message: "Are you sure you want to delete '{section_title}'?", context: 'A warning message that appears when the user tries to leave the page without saving their work', }, @@ -187,7 +184,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag '{ count, number } { count, plural, one { question successfully replaced } other { questions successfully replaced }} ', }, numberOfQuestionsSelected: { - message: '{count, number} {count, plural, one {question selected} other {questions selected}}', + message: 'Current number of questions in this section: {count, number}', }, numberOfResourcesSelected: { message: '{count, number} {count, plural, one {resource selected} other {resources selected}}', @@ -196,13 +193,9 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: '{count, number, integer} of {total, number, integer} {total, plural, one {question selected} other {questions selected}}', }, - selectMoreQuestion: { - message: - 'Select { count } more { count, plural , one { question } other { questions }} to continue', - }, - selectFewerQuestion: { + selectQuestionsToContinue: { message: - 'Select { count } fewer { count, plural ,one { question } other { questions }} to continue', + 'Select { count } { count, plural , one { question } other { questions }} to continue', }, selectQuiz: { message: 'Select quiz', @@ -216,14 +209,14 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag }, cannotSelectSomeTopicWarning: { message: - 'You can only select folders with { count, number } or less exercises and no subfolders to avoid oversized quizzes.', + 'You can only select folders with 12 or fewer exercises.', }, changesSavedSuccessfully: { message: 'Changes saved successfully', context: 'A snackbar message that appears when the user saves their changes', }, sectionDeletedNotification: { - message: "Section '{ section_title }' deleted", + message: "'{ section_title }' deleted", context: 'A snackbar message that appears when the user deletes a section', }, questionsDeletedNotification: { @@ -239,27 +232,27 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag notEnoughReplacementsTitle: { message: 'Not enough replacements available', context: - 'Title of modal when a user tries to replace more questions than are available in the pool', - }, - noReplacementsMessage: { - message: - 'There are no more similar questions available to replace the selected questions with.', - }, - notEnoughReplacementsMessage: { - message: - "You've selected { selected, number } { selected, plural, one { question } other { questions } } to replace, but {available, plural, =0 { don't have questions } one { only have 1 question } other { only have { available } questions } } available to replace them with.", - context: - 'Message of modal when a user tries to replace more questions than are available in the pool', - }, - addMoreQuestionsWithEmptyPool: { - message: 'You can add more questions, or delete existing questions.', - context: 'Message of modal when a user tries to replace questions but the pool is empty', - }, - addMoreQuestionsWithNonEmptyPool: { + 'Title of modal when a user tries to replace more questions than are available', + }, + // noReplacementsMessage: { + // message: + // 'There are no more similar questions available to replace the selected questions with.', + // }, + // notEnoughReplacementsMessage: { + // message: + // "You've selected { selected, number } { selected, plural, one { question } other { questions } } to replace, but {available, plural, =0 { don't have questions } one { only have 1 question } other { only have { available } questions } } available to replace them with.", + // context: + // 'Message of modal when a user tries to replace more questions than are available in the pool', + // }, + goBackAndUnselect: { + message: 'You can go back and unselect some questions to be able to perform the replacement.', + context: 'Message of modal when a user tries to replace questions but cannot do so', + }, + addMoreQuestions: { message: - 'You can add more questions, delete existing questions, or go back and select fewer questions', + 'You can add more exercises to increase the number of questions available. If you choose to add exercises, you will need to restart the replacement process.', context: - 'Message of modal when a user tries to replace more questions than are available in the pool', + 'Message of modal when a user tries to replace more questions than are available', }, addResourcesAction: { message: 'Add resources', @@ -276,7 +269,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag }, questionsLabel: { message: 'Questions', - context: 'Label for dropdown list of questions', + context: 'Label for a list of questions', }, saveAndClose: { message: 'Save and close', From 2145f5a99ea29ada600eff5d3613285033a3641c Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 18:56:56 -0400 Subject: [PATCH 02/23] Additional edit to string file for string freeze --- .../strings/enhancedQuizManagementStrings.js | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index e47e9c71196..e651f69de33 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -33,7 +33,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: 'There are no questions in this section', }, addQuizSectionQuestionsInstructions: { - message: 'To add questions, select resources from the available channels', + message: 'To add questions, select exercise from the available channels', }, addQuestionsLabel: { message: 'Add questions', @@ -54,11 +54,17 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag numberOfQuestionsLabel: { message: 'Number of questions', }, + numberOfQuestionsToAdd: { + message: 'Number of questions to add', + }, + tooManyQuestions: { + message: 'You cannot select more than { count, number } questions', + }, optionalDescriptionLabel: { message: 'Description (optional)', }, selectResources: { - message: 'Select resources', + message: 'Select exercises', }, sectionOrder: { message: 'Section order', @@ -95,7 +101,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: 'Replace questions in { sectionTitle }', }, changeResources: { - message: 'Change resources', + message: 'Change exercises', }, addAnswer: { message: 'Add answer', @@ -157,7 +163,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: 'Question edited successfully', }, reviewSelectedResources: { - message: 'Review selected resources', + message: 'Review selected exercises', }, deleteConfirmation: { message: "Are you sure you want to delete '{section_title}'?", @@ -186,9 +192,6 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag numberOfQuestionsSelected: { message: 'Current number of questions in this section: {count, number}', }, - numberOfResourcesSelected: { - message: '{count, number} {count, plural, one {resource selected} other {resources selected}}', - }, selectedQuestionsInformation: { message: '{count, number, integer} of {total, number, integer} {total, plural, one {question selected} other {questions selected}}', @@ -209,7 +212,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag }, cannotSelectSomeTopicWarning: { message: - 'You can only select folders with 12 or fewer exercises.', + 'You can only select entire folders when they have { count, number } questions or fewer.', }, changesSavedSuccessfully: { message: 'Changes saved successfully', @@ -224,7 +227,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag context: 'A snackbar message that appears when the user deletes questions', }, updateResources: { - message: 'Update resources', + message: 'Update exercises', }, allSectionsEmptyWarning: { message: "You don't have any questions in the quiz", @@ -255,7 +258,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag 'Message of modal when a user tries to replace more questions than are available', }, addResourcesAction: { - message: 'Add resources', + message: 'Add exercises', }, goBackAction: { message: 'Go back', @@ -265,7 +268,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag }, questionsFromResources: { message: - '{ questions, number } { questions, plural, one { question } other { questions }} in { resources, number } { resources, plural, one { resource } other { resources }}', + '{ questions, number } { questions, plural, one { question } other { questions }} in { exercises, number } { exercises, plural, one { exercise } other { exercises }}', }, questionsLabel: { message: 'Questions', From 3adaaaf72e6efd67c1805f5104c87892955f8bfc Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 18:58:31 -0400 Subject: [PATCH 03/23] Refactor resource selection to simplify UX. validation against max number of question options no, vs. folders/sub folders. Slightly rearranged side panel layout per ditto review --- kolibri/core/assets/src/constants.js | 2 + .../plan/CreateExamPage/ResourceSelection.vue | 211 +++++++++--------- .../ContentCardList.vue | 3 +- 3 files changed, 115 insertions(+), 101 deletions(-) diff --git a/kolibri/core/assets/src/constants.js b/kolibri/core/assets/src/constants.js index 0724341583e..18538e610dc 100644 --- a/kolibri/core/assets/src/constants.js +++ b/kolibri/core/assets/src/constants.js @@ -198,3 +198,5 @@ export const Presets = Object.freeze({ // This should be kept in sync with the value in // kolibri/core/exams/constants.py export const MAX_QUESTIONS_PER_QUIZ_SECTION = 50; +// this is not used for the actual exam model +export const MAX_QUESTION_OPTIONS_PER_QUIZ_SECTION = 500; diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue index c641f1c61bb..c0518c7869b 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -9,69 +9,55 @@
{{ selectPracticeQuizLabel$() }}
- - -
- {{ selectResourcesDescription$() }} -
- - {{ - maxNumberOfQuestionsPerSection$({ - count: MAX_QUESTIONS_PER_QUIZ_SECTION, current: activeQuestions.length - }) - }} - -
- -
-
- -
-
-
-
-
+
+ {{ selectResourcesDescription$({ sectionTitle: displaySectionTitle(activeSection, activeSectionIndex) }) }} +
+

{{ numberOfQuestionsSelected$({ count: activeQuestions.length}) }} + + +

{{ numberOfQuestionsToAdd$() }}

+
+
+ +
+
+
+
- - +
+
@@ -97,19 +83,6 @@
-
- {{ cannotSelectSomeTopicWarning$({ count: 12 }) }} -
- +
+ {{ cannotSelectSomeTopicWarning$({ count: 500 }) }} +
+ - {{ - questionsFromResources$({ - questions: workingPoolUnusedQuestions, resources: workingResourcePool.length - }) - }} + + {{ + tooManyQuestions$({ + count: maxSectionQuestionOptions + }) + }} + + + {{ + questionsFromResources$({ + questions: workingPoolUnusedQuestions, exercises: workingResourcePool.length + }) + }} + @@ -197,11 +192,11 @@ import get from 'lodash/get'; import uniqWith from 'lodash/uniqWith'; import isEqual from 'lodash/isEqual'; - import { enhancedQuizManagementStrings } from 'kolibri-common/strings/enhancedQuizManagementStrings'; + import { displaySectionTitle, enhancedQuizManagementStrings } from 'kolibri-common/strings/enhancedQuizManagementStrings'; import { computed, ref, getCurrentInstance, watch } from 'kolibri.lib.vueCompositionApi'; import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; import { ContentNodeResource, ChannelResource } from 'kolibri.resources'; - import { ContentNodeKinds, MAX_QUESTIONS_PER_QUIZ_SECTION } from 'kolibri.coreVue.vuex.constants'; + import { ContentNodeKinds, MAX_QUESTIONS_PER_QUIZ_SECTION, MAX_QUESTION_OPTIONS_PER_QUIZ_SECTION } from 'kolibri.coreVue.vuex.constants'; import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow'; import { exerciseToQuestionArray } from '../../../utils/selectQuestions'; import { PageNames, ViewMoreButtonStates } from '../../../constants/index'; @@ -231,6 +226,7 @@ const showBookmarks = computed(() => route.value.query.showBookmarks); const searchQuery = computed(() => route.value.query.search); const { + activeSection, activeSectionIndex, allResourceMap, updateSection, @@ -244,6 +240,8 @@ const maxQuestions = computed( () => MAX_QUESTIONS_PER_QUIZ_SECTION - activeQuestions.value.length ); + const maxSectionQuestionOptions = computed(() => MAX_QUESTION_OPTIONS_PER_QUIZ_SECTION); + const questionCount = ref(Math.min(10, maxQuestions.value)); const selectPracticeQuiz = computed(() => props.selectPracticeQuiz); @@ -260,6 +258,9 @@ closeConfirmationMessage$, closeConfirmationTitle$, questionsUnusedInSection$, + numberOfQuestionsSelected$, + numberOfQuestionsToAdd$, + tooManyQuestions$, selectQuiz$, selectPracticeQuizLabel$, numberOfQuestionsLabel$, @@ -306,7 +307,7 @@ */ function selectableContentList() { return contentList.value.reduce((newList, content) => { - if (content.kind === ContentNodeKinds.TOPIC && actuallyHasCheckbox(content)) { + if (content.kind === ContentNodeKinds.TOPIC && folderDoesNotHaveTooManyQuestions(content)) { newList = [...newList, ...content.children.results]; } else { newList.push(content); @@ -387,7 +388,7 @@ const showSelectAll = computed(() => { return ( !selectPracticeQuiz.value && - contentList.value.every(content => actuallyHasCheckbox(content)) + contentList.value.every(content => folderDoesNotHaveTooManyQuestions(content)) ); }); @@ -473,10 +474,8 @@ * -- Note that for topics, hasCheckbox will only be true if all children are Exercises, * so we can call this recursively without worrying about it going too deep */ - function actuallyHasCheckbox(content) { - return content.kind === ContentNodeKinds.EXERCISE - ? hasCheckbox(content) && unusedQuestionsCount(content) > 0 - : hasCheckbox(content) && content.children.results.some(actuallyHasCheckbox); + function folderDoesNotHaveTooManyQuestions(content) { + return content.num_assessments < 500; } // Load up the channels @@ -602,14 +601,16 @@ return ( !workingPoolHasChanged.value || workingPoolUnusedQuestions.value < questionCount.value || - questionCount.value > maxQuestions.value || - questionCount.value < 1 + questionCount.value < 1 || + workingPoolUnusedQuestions.value > maxSectionQuestionOptions.value ); }); return { - actuallyHasCheckbox, + folderDoesNotHaveTooManyQuestions, + displaySectionTitle, unusedQuestionsCount, + activeSection, activeSectionIndex, activeQuestions, addSection, @@ -636,6 +637,7 @@ contentPresentInWorkingResourcePool, questionCount, maxQuestions, + maxSectionQuestionOptions, MAX_QUESTIONS_PER_QUIZ_SECTION, workingPoolUnusedQuestions, disableSave, @@ -644,6 +646,8 @@ closeConfirmationTitle$, changesSavedSuccessfully$, sectionSettings$, + numberOfQuestionsSelected$, + tooManyQuestions$, selectFromBookmarks$, numberOfSelectedBookmarks$, questionsUnusedInSection$, @@ -662,6 +666,7 @@ showBookmarks, selectedQuestionsInformation$, selectQuiz$, + numberOfQuestionsToAdd$, selectPracticeQuizLabel$, numberOfQuestionsLabel$, maxNumberOfQuestions$, @@ -698,8 +703,8 @@ }, }; }, - showTopicSizeWarning() { - return this.contentList.some(this.showTopicSizeWarningCard); + showNumberOfQuestionsWarning() { + return this.contentList.some(this.showNumberOfQuestionsWarningCard); }, borderStyle() { return `border: 1px solid ${this.$themeTokens.fineLine}`; @@ -738,11 +743,10 @@ return ''; } }, - showTopicSizeWarningCard(content) { + showNumberOfQuestionsWarningCard(content) { return ( !this.selectPracticeQuiz && - !this.actuallyHasCheckbox(content) && - content.kind === ContentNodeKinds.TOPIC + content.num_assessments > 500 ); }, /** @public */ @@ -940,7 +944,6 @@ .number-question { display: inline-flex; - float: right; } .group-button-border { @@ -950,4 +953,12 @@ border: 1px solid; } + .divider { + display: block; + min-width: 100%; + height: 1px; + margin: 24px 0; + overflow-y: hidden; + } + diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue index 74e7166b92a..7d01dffa7d7 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue @@ -41,7 +41,7 @@ class="content-card" :disabled="content.is_leaf" :tabindex="content.is_leaf ? -1 : 0" - :class="{ 'with-checkbox': needCheckboxes, 'is-leaf': content.is_leaf }" + :class="{ 'with-checkbox': needCheckboxes }" :title="content.title" :thumbnail="content.thumbnail" :description="content.description" @@ -172,6 +172,7 @@ return this.viewMoreButtonState === this.ViewMoreButtonStates.HAS_MORE; }, needCheckboxes() { + console.log(this.contentHasCheckbox); return this.contentList.some(c => this.contentHasCheckbox(c)); }, }, From b38c9c992d046e60f41de6d58db91b5edb4bc2c7 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 18:59:08 -0400 Subject: [PATCH 04/23] Fix broken string reference keys --- .../src/views/plan/CreateExamPage/ReplaceQuestions.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue index 2026fc32769..96f1c0985a7 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue @@ -198,7 +198,7 @@ numberOfSelectedReplacements$, numberOfQuestionsReplaced$, noUndoWarning$, - selectMoreQuestion$, + selectQuestionsToContinue$, selectFewerQuestion$, collapseAll$, expandAll$, @@ -327,7 +327,7 @@ noUndoWarning$, replaceQuestionsExplaination$, replaceQuestionsHeading$, - selectMoreQuestion$, + selectQuestionsToContinue$, selectFewerQuestion$, collapseAll$, expandAll$, @@ -362,7 +362,7 @@ total: this.selectedActiveQuestions.length, }); } else if (unreplacedCount > 0) { - return this.selectMoreQuestion$({ + return this.selectQuestionsToContinue$({ count: unreplacedCount, }); } else { From 583e8e21d3e085fab943609be528cb2bd4fda060 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 19:28:47 -0400 Subject: [PATCH 05/23] Fix checkbox bug --- .../views/plan/LessonResourceSelectionPage/ContentCardList.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue index 7d01dffa7d7..0d66c647014 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue @@ -172,7 +172,6 @@ return this.viewMoreButtonState === this.ViewMoreButtonStates.HAS_MORE; }, needCheckboxes() { - console.log(this.contentHasCheckbox); return this.contentList.some(c => this.contentHasCheckbox(c)); }, }, From 3f68cf87a373585e9fb7797395544fe819bb0ed5 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 19:29:24 -0400 Subject: [PATCH 06/23] Display number of replacement questions available. Disable replacement when there is a mis-match --- .../plan/CreateExamPage/CreateQuizSection.vue | 24 +++++++------------ .../plan/CreateExamPage/ResourceSelection.vue | 4 ++-- .../strings/enhancedQuizManagementStrings.js | 6 ++--- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index 1c1bddd34b2..36da3464d84 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -1,9 +1,6 @@ - - - diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index 658ac3c991b..23923f005cb 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -232,34 +232,6 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag allSectionsEmptyWarning: { message: "You don't have any questions in the quiz", }, - notEnoughReplacementsTitle: { - message: 'Not enough replacements available', - context: - 'Title of modal when a user tries to replace more questions than are available', - }, - // noReplacementsMessage: { - // message: - // 'There are no more similar questions available to replace the selected questions with.', - // }, - // notEnoughReplacementsMessage: { - // message: - // "You've selected { selected, number } { selected, plural, one { question } other { questions } } to replace, but {available, plural, =0 { don't have questions } one { only have 1 question } other { only have { available } questions } } available to replace them with.", - // context: - // 'Message of modal when a user tries to replace more questions than are available in the pool', - // }, - goBackAndUnselect: { - message: 'You can go back and unselect some questions to be able to perform the replacement.', - context: 'Message of modal when a user tries to replace questions but cannot do so', - }, - addMoreQuestions: { - message: - 'You can add more exercises to increase the number of questions available. If you choose to add exercises, you will need to restart the replacement process.', - context: - 'Message of modal when a user tries to replace more questions than are available', - }, - addResourcesAction: { - message: 'Add exercises', - }, goBackAction: { message: 'Go back', }, From 5a50ffe0973046aa4de4d5e383c03f3a2efdbf69 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 19:46:54 -0400 Subject: [PATCH 08/23] Remove stray reference to NotEnoughReplacementsModal --- .../assets/src/views/plan/CreateExamPage/CreateQuizSection.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index d02b1497e1a..8bfc39af5ae 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -346,7 +346,6 @@ import commonCoach from '../../common'; import { PageNames } from '../../../constants'; import TabsWithOverflow from './TabsWithOverflow'; - import NotEnoughResourcesModal from './NotEnoughResourcesModal'; const logger = logging.getLogger(__filename); @@ -360,7 +359,6 @@ DragSortWidget, DragHandle, TabsWithOverflow, - NotEnoughResourcesModal, }, mixins: [commonCoreStrings, commonCoach], setup() { From 6d4a533757c19a7c993e7b5f6a2189fb0b8e82d9 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 20:13:37 -0400 Subject: [PATCH 09/23] Reinstate v-else condition which should not have been removed --- .../plan/CreateExamPage/ResourceSelection.vue | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue index 1cba4833f18..2a292fe5962 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -5,14 +5,16 @@
-
{{ selectPracticeQuizLabel$() }}
-
- {{ selectResourcesDescription$({ sectionTitle: displaySectionTitle(activeSection, activeSectionIndex) }) }} -
-

{{ numberOfQuestionsSelected$({ count: activeQuestions.length}) }} +

+
+ {{ selectResourcesDescription$({ + sectionTitle: displaySectionTitle(activeSection, activeSectionIndex) + }) }} +
+

{{ numberOfQuestionsSelected$({ count: activeQuestions.length}) }}

+
@@ -307,7 +310,9 @@ */ function selectableContentList() { return contentList.value.reduce((newList, content) => { - if (content.kind === ContentNodeKinds.TOPIC && folderDoesNotHaveTooManyQuestions(content)) { + if (content.kind === ContentNodeKinds.TOPIC + && folderDoesNotHaveTooManyQuestions(content)) + { newList = [...newList, ...content.children.results]; } else { newList.push(content); @@ -466,16 +471,8 @@ } return -1; } - /** - * Uses the imported `hasCheckbox` method in addition to some locally relevant conditions - * to identify if the content has a checkbox. - * For Exercises, we make sure there are questions available in the resource - * For Topics, we make sure that there are questions available in the children - * -- Note that for topics, hasCheckbox will only be true if all children are Exercises, - * so we can call this recursively without worrying about it going too deep - */ function folderDoesNotHaveTooManyQuestions(content) { - return content.kind == ContentNodeKinds.EXERCISE|| content.num_assessments < 500; + return content.kind == ContentNodeKinds.EXERCISE || content.num_assessments < 500; } // Load up the channels From fb7b65c8738845689ecec123fc2d9d903981062f Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 20:14:35 -0400 Subject: [PATCH 10/23] reinstate parameterization in string --- .../kolibri-common/strings/enhancedQuizManagementStrings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index 23923f005cb..adf01af0aea 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -88,7 +88,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: '{count, number} {count, plural, one {question selected} other {questions selected}}', }, maxNumberOfQuestions: { - message: 'Maximum number of questions is 50', + message: 'Max number of questions is { count, number }' }, maxNumberOfQuestionsPerSection: { message: From 8966326800be034a0246ae809fd03e591fc60403 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 20:33:11 -0400 Subject: [PATCH 11/23] clean up unused strings --- .../plan/CreateExamPage/CreateQuizSection.vue | 2 - .../plan/CreateExamPage/ResourceSelection.vue | 8 +-- .../strings/enhancedQuizManagementStrings.js | 51 ------------------- 3 files changed, 1 insertion(+), 60 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index 8bfc39af5ae..7da581a29e0 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -378,7 +378,6 @@ numberOfReplacementsAvailable$, sectionDeletedNotification$, deleteConfirmation$, - updateResources$, changesSavedSuccessfully$, questionsDeletedNotification$, expandAll$, @@ -462,7 +461,6 @@ addSection, removeSection, updateQuiz, - updateResources$, displaySectionTitle, displayQuestionTitle, diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue index 2a292fe5962..8f63bd4a434 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -64,7 +64,7 @@
-

{{ selectFromBookmarks$() }}

+

{{ coreString('selectFromBookmarks') }}

Date: Wed, 19 Jun 2024 20:54:39 -0400 Subject: [PATCH 12/23] remove unused function --- .../src/views/plan/CreateExamPage/CreateQuizSection.vue | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index 7da581a29e0..702bdad3dbe 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -683,10 +683,6 @@ }) ); }, - redirectToSelectResources() { - this.showNotEnoughResourcesModal = false; - this.openSelectResources(); - }, }, }; From 8e832d52563f3ef72699b0bf85f380a3b517769e Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 20:55:37 -0400 Subject: [PATCH 13/23] reinstate string I shouldn't have deleted --- .../src/views/plan/CreateExamPage/ResourceSelection.vue | 2 ++ .../kolibri-common/strings/enhancedQuizManagementStrings.js | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue index 8f63bd4a434..11706b20529 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -262,6 +262,7 @@ questionsUnusedInSection$, numberOfQuestionsSelected$, numberOfQuestionsToAdd$, + maxNumberOfQuestions$, tooManyQuestions$, selectQuiz$, selectPracticeQuizLabel$, @@ -642,6 +643,7 @@ sectionSettings$, numberOfQuestionsSelected$, tooManyQuestions$, + maxNumberOfQuestions$, numberOfSelectedBookmarks$, questionsUnusedInSection$, selectResourcesDescription$, diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index dc1d03eff40..7674a09e68b 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -75,6 +75,9 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag numberOfSelectedQuestions: { message: '{count, number} {count, plural, one {question selected} other {questions selected}}', }, + maxNumberOfQuestions: { + message: 'Maximum number of questions is { count, number }', + }, replaceQuestions: { message: 'Replace questions in { sectionTitle }', }, @@ -171,7 +174,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag }, cannotSelectSomeTopicWarning: { message: - 'You can only select entire folders when they have { count, number } questions or fewer.', + 'You can only select a total of { count, number } questions or fewer.' }, changesSavedSuccessfully: { message: 'Changes saved successfully', From 8dca44e411eb352035c1300281d429febe956fe7 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 21:02:13 -0400 Subject: [PATCH 14/23] Ensure sectionTitle displays properly and doesn't break question replacement side panel --- .../assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue index 96f1c0985a7..b62e6bf1952 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue @@ -10,7 +10,7 @@ >

- {{ replaceQuestions$() }} + {{ replaceQuestions$({sectionTitle: displaySectionTitle(activeSection, activeSectionIndex)}) }}

{{ replaceQuestionsHeading$() }}

From 213baa1c0a6b6e00345baf83d4a942f3a62bff03 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 21:29:33 -0400 Subject: [PATCH 15/23] More string modifications --- .../strings/enhancedQuizManagementStrings.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index 7674a09e68b..74a72d44792 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -24,7 +24,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag message: 'There are no questions in this section', }, addQuizSectionQuestionsInstructions: { - message: 'To add questions, select exercise from the available channels', + message: 'To add questions, select resources from the available channels', }, addQuestionsLabel: { message: 'Add questions', @@ -145,7 +145,8 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag '{ count, number } of { total, number } {total, plural, one {replacement selected} other {replacements selected}}', }, numberOfReplacementsAvailable: { - message: '{count, number, integer} {count, plural, one {replacement question available} other {replacement questions available}}', + message: + '{count, number, integer} {count, plural, one {replacement question available} other {replacement questions available}}', }, numberOfQuestionsReplaced: { message: @@ -159,8 +160,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag '{count, number, integer} of {total, number, integer} {total, plural, one {question selected} other {questions selected}}', }, selectQuestionsToContinue: { - message: - 'Select { count } { count, plural , one { question } other { questions }} to continue', + message: 'Select { count } { count, plural , one { question } other { questions }} to continue', }, selectQuiz: { message: 'Select quiz', @@ -173,8 +173,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag "Practice quizzes are pre-made quizzes, that don't require the curation work on the part of the coach. Selecting a practice quiz refers to importing a ready-to-use quiz.", }, cannotSelectSomeTopicWarning: { - message: - 'You can only select a total of { count, number } questions or fewer.' + message: 'You can only select a total of { count, number } questions or fewer.', }, changesSavedSuccessfully: { message: 'Changes saved successfully', @@ -196,7 +195,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag }, questionsFromResources: { message: - '{ questions, number } { questions, plural, one { question } other { questions }} in { exercises, number } { exercises, plural, one { exercise } other { exercises }}', + '{ questions, number } { questions, plural, one { question } other { questions }} selected', }, questionsLabel: { message: 'Questions', From 169afa2519df4e766a715dcf7e03b60405cca32a Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 21:31:16 -0400 Subject: [PATCH 16/23] linting cleanup --- .../src/views/plan/CreateExamPage/CreateQuizSection.vue | 9 +++++++-- .../src/views/plan/CreateExamPage/ReplaceQuestions.vue | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue index 702bdad3dbe..c978a11ddf9 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -141,7 +141,9 @@

{{ questionsLabel$() }}

-

{{ numberOfReplacementsAvailable$({ count: replacementQuestionPool.length }) }}

+

+ {{ numberOfReplacementsAvailable$({ count: replacementQuestionPool.length }) }} +

0 && this.selectedActiveQuestions.length <= this.replacementQuestionPool.length + return ( + this.selectedActiveQuestions.length > 0 && + this.selectedActiveQuestions.length <= this.replacementQuestionPool.length + ); }, tabsWrapperStyles() { return { diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue index b62e6bf1952..23d11e111b6 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue @@ -10,7 +10,9 @@ >

- {{ replaceQuestions$({sectionTitle: displaySectionTitle(activeSection, activeSectionIndex)}) }} + {{ replaceQuestions$({ + sectionTitle: displaySectionTitle(activeSection, activeSectionIndex + ) }) }}

{{ replaceQuestionsHeading$() }}

From 0fb356ebcbfb5f245aebcee9712ea69c59960a5e Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Wed, 19 Jun 2024 21:47:15 -0400 Subject: [PATCH 17/23] fix not-returned hasCheckbox value --- .../plan/CreateExamPage/ResourceSelection.vue | 119 +++++++++--------- 1 file changed, 63 insertions(+), 56 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue index 11706b20529..a7baa3fadd3 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -10,55 +10,56 @@
- {{ selectResourcesDescription$({ - sectionTitle: displaySectionTitle(activeSection, activeSectionIndex) - }) }} + {{ selectResourcesDescription$({ + sectionTitle: displaySectionTitle(activeSection, activeSectionIndex) + }) }}
-

{{ numberOfQuestionsSelected$({ count: activeQuestions.length}) }} - - -

{{ numberOfQuestionsToAdd$() }}

-
-
- -
-
-
+ {{ numberOfQuestionsSelected$({ count: activeQuestions.length }) }} + -
@@ -195,11 +196,18 @@ import get from 'lodash/get'; import uniqWith from 'lodash/uniqWith'; import isEqual from 'lodash/isEqual'; - import { displaySectionTitle, enhancedQuizManagementStrings } from 'kolibri-common/strings/enhancedQuizManagementStrings'; + import { + displaySectionTitle, + enhancedQuizManagementStrings, + } from 'kolibri-common/strings/enhancedQuizManagementStrings'; import { computed, ref, getCurrentInstance, watch } from 'kolibri.lib.vueCompositionApi'; import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; import { ContentNodeResource, ChannelResource } from 'kolibri.resources'; - import { ContentNodeKinds, MAX_QUESTIONS_PER_QUIZ_SECTION, MAX_QUESTION_OPTIONS_PER_QUIZ_SECTION } from 'kolibri.coreVue.vuex.constants'; + import { + ContentNodeKinds, + MAX_QUESTIONS_PER_QUIZ_SECTION, + MAX_QUESTION_OPTIONS_PER_QUIZ_SECTION, + } from 'kolibri.coreVue.vuex.constants'; import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow'; import { exerciseToQuestionArray } from '../../../utils/selectQuestions'; import { PageNames, ViewMoreButtonStates } from '../../../constants/index'; @@ -263,7 +271,7 @@ numberOfQuestionsSelected$, numberOfQuestionsToAdd$, maxNumberOfQuestions$, - tooManyQuestions$, + tooManyQuestions$, selectQuiz$, selectPracticeQuizLabel$, numberOfQuestionsLabel$, @@ -308,9 +316,10 @@ */ function selectableContentList() { return contentList.value.reduce((newList, content) => { - if (content.kind === ContentNodeKinds.TOPIC - && folderDoesNotHaveTooManyQuestions(content)) - { + if ( + content.kind === ContentNodeKinds.TOPIC && + folderDoesNotHaveTooManyQuestions(content) + ) { newList = [...newList, ...content.children.results]; } else { newList.push(content); @@ -596,7 +605,7 @@ return ( !workingPoolHasChanged.value || workingPoolUnusedQuestions.value < questionCount.value || - questionCount.value < 1 || + questionCount.value < 1 || workingPoolUnusedQuestions.value > maxSectionQuestionOptions.value ); }); @@ -604,6 +613,7 @@ return { folderDoesNotHaveTooManyQuestions, displaySectionTitle, + hasCheckbox, unusedQuestionsCount, activeSection, activeSectionIndex, @@ -737,10 +747,7 @@ } }, showNumberOfQuestionsWarningCard(content) { - return ( - !this.selectPracticeQuiz && - content.num_assessments > 500 - ); + return !this.selectPracticeQuiz && content.num_assessments > 500; }, /** @public */ focusFirstEl() { From 00c010f1f4f950be471fd9cc9e53e0e65a2647be Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Thu, 20 Jun 2024 10:37:06 -0400 Subject: [PATCH 18/23] Make sure activeSection title related values are properly imported and referenced --- .../assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue index 23d11e111b6..b26b3036aa2 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue @@ -211,6 +211,7 @@ const { // Computed activeSection, + activeSectionIndex, selectedActiveQuestions, activeResourceMap, replacementQuestionPool, @@ -305,6 +306,7 @@ toggleInReplacements, activeSection, + activeSectionIndex, activeSectionTitle, selectAllReplacementQuestions, selectedActiveQuestions, @@ -336,6 +338,7 @@ collapseAll$, expandAll$, displayQuestionTitle, + displaySectionTitle, }; }, computed: { From 19a74e765ab8ccf2871ff5aa0062088a35e73e53 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Thu, 20 Jun 2024 09:16:42 -0700 Subject: [PATCH 19/23] Update unused question messaging to be consistent across all node types. --- .../plan/CreateExamPage/ResourceSelection.vue | 55 +++++++++---------- .../strings/enhancedQuizManagementStrings.js | 4 -- 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue index a7baa3fadd3..bdf83a2864f 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -128,11 +128,7 @@ @changeselectall="handleSelectAll" @change_content_card="toggleSelected" @moreresults="fetchMoreResources" - > - - + />
@@ -263,7 +259,6 @@ selectResourcesDescription$, questionsFromResources$, changesSavedSuccessfully$, - selectedQuestionsInformation$, cannotSelectSomeTopicWarning$, closeConfirmationMessage$, closeConfirmationTitle$, @@ -476,6 +471,19 @@ const questionItemsAvailable = questionItems.length - questionsItemsAlreadyUsed.length; return questionItemsAvailable; } + if (content.kind === ContentNodeKinds.TOPIC || content.kind === ContentNodeKinds.CHANNEL) { + const total = content.num_assessments; + const numberOfQuestionsSelected = allQuestionsInQuiz.value.filter(question => { + const questionNode = allResourceMap.value[question.exercise_id]; + for (const ancestor of questionNode.ancestors) { + if (ancestor.id === content.id) { + return true; + } + } + return false; + }).length; + return total - numberOfQuestionsSelected; + } return -1; } function folderDoesNotHaveTooManyQuestions(content) { @@ -669,7 +677,6 @@ addToWorkingResourcePool, removeFromWorkingResourcePool, showBookmarks, - selectedQuestionsInformation$, selectQuiz$, numberOfQuestionsToAdd$, selectPracticeQuizLabel$, @@ -737,15 +744,6 @@ } }, methods: { - cardNoticeContent(content) { - if (!this.selectPracticeQuiz && content.kind === ContentNodeKinds.EXERCISE) { - return this.questionsUnusedInSection$({ - count: this.unusedQuestionsCount(content), - }); - } else { - return ''; - } - }, showNumberOfQuestionsWarningCard(content) { return !this.selectPracticeQuiz && content.num_assessments > 500; }, @@ -809,23 +807,20 @@ }, // The message put onto the content's card when listed selectionMetadata(content) { - if (this.selectPracticeQuiz || content.kind !== ContentNodeKinds.TOPIC) { + if (this.selectPracticeQuiz) { + return; + } + + const count = this.unusedQuestionsCount(content); + + if (count === -1) { + // If for some reason we're getting a content type that we don't know how to handle + // we'll just return nothing to avoid displaying a nonsensical message return; } - const total = content.num_assessments; - const numberOfQuestionsSelected = this.allQuestionsInQuiz.filter(question => { - const questionNode = this.allResourceMap[question.exercise_id]; - for (const ancestor of questionNode.ancestors) { - if (ancestor.id === content.id) { - return true; - } - } - return false; - }).length; - return this.selectedQuestionsInformation$({ - count: numberOfQuestionsSelected, - total: total, + return this.questionsUnusedInSection$({ + count, }); }, handleSearchTermChange(searchTerm) { diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index 74a72d44792..bae60517bf3 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -155,10 +155,6 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag numberOfQuestionsSelected: { message: 'Current number of questions in this section: {count, number}', }, - selectedQuestionsInformation: { - message: - '{count, number, integer} of {total, number, integer} {total, plural, one {question selected} other {questions selected}}', - }, selectQuestionsToContinue: { message: 'Select { count } { count, plural , one { question } other { questions }} to continue', }, From e80e52fccc4a31c3f7c8f1345306368d907ccb58 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Thu, 20 Jun 2024 12:28:59 -0400 Subject: [PATCH 20/23] Add additional strings to explain no learner or no resources scenarios --- .../strings/enhancedQuizManagementStrings.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js index bae60517bf3..15ca31dbdb4 100644 --- a/packages/kolibri-common/strings/enhancedQuizManagementStrings.js +++ b/packages/kolibri-common/strings/enhancedQuizManagementStrings.js @@ -90,6 +90,13 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag replaceAction: { message: 'Replace', }, + noLearnersEnrolled: { + message: 'No learners enrolled in { className }', + }, + noResourcesAvailable: { + message: + 'There are no resources on your device yet. Ask an administrator to add resources to your device.', + }, replaceQuestionsHeading: { message: 'The new questions you select will replace the current ones.', }, From cccf97f5163e74e39d70280028efae6927e4d6f2 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Thu, 20 Jun 2024 13:54:55 -0400 Subject: [PATCH 21/23] Ensure simplified replacement direction string is used --- .../src/views/plan/CreateExamPage/ReplaceQuestions.vue | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue index b26b3036aa2..3be3c7cfb20 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue @@ -368,13 +368,9 @@ count: this.replacements.length, total: this.selectedActiveQuestions.length, }); - } else if (unreplacedCount > 0) { - return this.selectQuestionsToContinue$({ - count: unreplacedCount, - }); } else { - return this.selectFewerQuestion$({ - count: Math.abs(unreplacedCount), + return this.selectQuestionsToContinue$({ + count: this.selectedActiveQuestions.length, }); } }, From 20023b2007b75d09ad9dec202bc0aec6a01e9d6f Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Thu, 20 Jun 2024 15:03:10 -0400 Subject: [PATCH 22/23] Remove duplicative header --- .../src/views/plan/CreateExamPage/ReplaceQuestions.vue | 8 -------- 1 file changed, 8 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue index 3be3c7cfb20..98697b72f42 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ReplaceQuestions.vue @@ -1,14 +1,6 @@