Skip to content

Commit

Permalink
update message for questions in exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
nucleogenesis committed May 31, 2024
1 parent 23ba159 commit bab6c45
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
:selectAllChecked="selectAllChecked"
:selectAllIndeterminate="selectAllIndeterminate"
:contentIsChecked="contentPresentInWorkingResourcePool"
:contentHasCheckbox="hasCheckbox"
:contentHasCheckbox="c => hasCheckbox(c) && unusedQuestionsCount(c) > 0"
:contentCardMessage="selectionMetadata"
:contentCardLink="contentLink"
:loadingMoreState="loadingMore"
Expand Down Expand Up @@ -172,6 +172,7 @@
cannotSelectSomeTopicWarning$,
closeConfirmationMessage$,
closeConfirmationTitle$,
questionsUnusedInSection$,
} = enhancedQuizManagementStrings;
// TODO let's not use text for this
Expand Down Expand Up @@ -490,6 +491,7 @@
sectionSettings$,
selectFromBookmarks$,
numberOfSelectedBookmarks$,
questionsUnusedInSection$,
selectFoldersOrExercises$,
numberOfSelectedResources$,
numberOfResourcesSelected$,
Expand Down Expand Up @@ -551,23 +553,24 @@
}
},
methods: {
cardNoticeContent(content) {
unusedQuestionsCount(content) {
if (content.kind === ContentNodeKinds.EXERCISE) {
const questionCount = content.assessmentmetadata.assessment_item_ids.length;
const questionItems = content.assessmentmetadata.assessment_item_ids.map(
aid => `${content.id}:${aid}`
);
const questionsItemsAlreadyUsed = this.allQuestionsInQuiz
.map(q => q.item)
.filter(i => questionItems.includes(i));
const questionItemsAvailable = questionItems.length - questionsItemsAlreadyUsed.length;
if (questionsItemsAlreadyUsed.length) {
return `${questionItemsAvailable} of ${questionCount} questions available,
${questionsItemsAlreadyUsed.length} questions are used in other sections`;
} else {
return `${questionCount} questions`;
}
return questionItemsAvailable;
}
return -1;
},
cardNoticeContent(content) {
if (content.kind === ContentNodeKinds.EXERCISE) {
return this.questionsUnusedInSection$({
count: this.unusedQuestionsCount(content),
});
} else {
return '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag
allSectionsEmptyWarning: {
message: "You don't have any questions in the quiz",
},
questionsUnusedInSection: {
message: '{ count, number } { count, plural, one { question } other { questions }} unused',
},
});

0 comments on commit bab6c45

Please sign in to comment.