diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js index 652a2625ebd..0e22a87ae25 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js @@ -421,6 +421,13 @@ export default function useQuizCreation(DEBUG = false) { ); /** @type {ComputedRef} The active section's `resource_pool` */ const activeResourcePool = computed(() => get(activeSection).resource_pool); + /** @type {ComputedRef} The active section's `resource_pool` */ + const activeResourceMap = computed(() => + get(activeResourcePool).reduce((acc, resource) => { + acc[resource.content_id] = resource; + return acc; + }, {}) + ); /** @type {ComputedRef} All questions in the active section's `resource_pool` * exercises */ const activeQuestionsPool = computed(() => []); @@ -530,6 +537,7 @@ export default function useQuizCreation(DEBUG = false) { provide('activeSection', activeSection); provide('inactiveSections', inactiveSections); provide('activeResourcePool', activeResourcePool); + provide('activeResourceMap', activeResourceMap); provide('workingResourcePool', workingResourcePool); provide('activeQuestionsPool', activeQuestionsPool); provide('activeQuestions', activeQuestions); @@ -565,6 +573,7 @@ export default function useQuizCreation(DEBUG = false) { inactiveSections, workingResourcePool, activeResourcePool, + activeResourceMap, activeQuestionsPool, activeQuestions, selectedActiveQuestions, @@ -607,6 +616,7 @@ export function injectQuizCreation() { const activeSection = inject('activeSection'); const inactiveSections = inject('inactiveSections'); const activeResourcePool = inject('activeResourcePool'); + const activeResourceMap = inject('activeResourceMap'); const workingResourcePool = inject('workingResourcePool'); const activeQuestionsPool = inject('activeQuestionsPool'); const activeQuestions = inject('activeQuestions'); @@ -645,6 +655,7 @@ export function injectQuizCreation() { inactiveSections, workingResourcePool, activeResourcePool, + activeResourceMap, activeQuestionsPool, activeQuestions, selectedActiveQuestions, 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 58abdf291e1..a3b1367763e 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreateQuizSection.vue @@ -281,16 +281,25 @@ @@ -386,6 +395,8 @@ inactiveSections, workingResourcePool, activeQuestionsPool, + activeResourceMap, + activeResourcePool, activeQuestions, selectedActiveQuestions, replacementQuestionPool, @@ -434,6 +445,8 @@ activeSection, inactiveSections, workingResourcePool, + activeResourceMap, + activeResourcePool, activeQuestionsPool, activeQuestions, selectedActiveQuestions,