From 0dade88ab797cf374081ac21ee918a7d480d6e3f Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Fri, 14 Jun 2024 16:12:01 -0700 Subject: [PATCH] Don't show num assessments info for practice quiz selection. Ensure we don't show any topics without children, even if the unfiltered num assessments says otherwise. --- .../coach/assets/src/composables/useQuizResources.js | 7 +++++++ .../src/views/plan/CreateExamPage/ResourceSelection.vue | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizResources.js b/kolibri/plugins/coach/assets/src/composables/useQuizResources.js index 7951d569a5..58203edcc5 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizResources.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizResources.js @@ -67,6 +67,13 @@ export default function useQuizResources({ topicId, practiceQuiz = false } = {}) // return null so we can easily filter after return null; } + if (node.kind === ContentNodeKinds.TOPIC && !node.children) { + // If the topic has no children, we can assume it has no assessments + // Only do this check for topics, because CHANNEL kinds are normally + // ChannelMetadata objects masquerading as ContentNode objects + // and so don't have children + return null; + } node.num_assessments = topicsWithAssessmentCountsMap[node.id]; } return node; 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 20747af234..c641f1c61b 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -730,7 +730,7 @@ }, methods: { cardNoticeContent(content) { - if (content.kind === ContentNodeKinds.EXERCISE) { + if (!this.selectPracticeQuiz && content.kind === ContentNodeKinds.EXERCISE) { return this.questionsUnusedInSection$({ count: this.unusedQuestionsCount(content), });