Skip to content

Commit

Permalink
temp dummy string for questions information
Browse files Browse the repository at this point in the history
  • Loading branch information
nucleogenesis committed May 29, 2024
1 parent f0d37b2 commit a046f94
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ export default function useQuizCreation() {
});

provide('saveQuiz', saveQuiz);
provide('allQuestionsInQuiz', allQuestionsInQuiz);
provide('updateSection', updateSection);
provide('handleReplacement', handleReplacement);
provide('replaceSelectedQuestions', replaceSelectedQuestions);
Expand Down Expand Up @@ -548,6 +549,7 @@ export default function useQuizCreation() {
allSectionsEmpty,
allQuestionsSelected,
noQuestionsSelected,
allQuestionsInQuiz,
};

/*
Expand All @@ -562,6 +564,7 @@ export default function useQuizCreation() {

export function injectQuizCreation() {
const saveQuiz = inject('saveQuiz');
const allQuestionsInQuiz = inject('allQuestionsInQuiz');
const updateSection = inject('updateSection');
const handleReplacement = inject('handleReplacement');
const replaceSelectedQuestions = inject('replaceSelectedQuestions');
Expand Down Expand Up @@ -611,6 +614,7 @@ export function injectQuizCreation() {

// Computed
allQuestionsSelected,
allQuestionsInQuiz,
selectAllIsIndeterminate,
channels,
replacements,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@
@changeselectall="handleSelectAll"
@change_content_card="toggleSelected"
@moreresults="fetchMoreResources"
/>
>
<template #notice="{ content }">
<span style="position: absolute; bottom: 1em;">{{ cardNoticeContent(content) }}</span>
</template>
</ContentCardList>

<div class="bottom-navigation">
<KGrid>
Expand Down Expand Up @@ -146,7 +150,12 @@
// to be added to Quiz Section.
const showBookmarks = computed(() => route.value.query.showBookmarks);
const searchQuery = computed(() => route.value.query.search);
const { updateSection, activeResourcePool, selectAllQuestions } = injectQuizCreation();
const {
updateSection,
activeResourcePool,
selectAllQuestions,
allQuestionsInQuiz,
} = injectQuizCreation();
const showCloseConfirmation = ref(false);
const prevRoute = ref({ name: PageNames.EXAM_CREATION_ROOT });
Expand Down Expand Up @@ -451,6 +460,7 @@
});
return {
allQuestionsInQuiz,
selectAllChecked,
selectAllIndeterminate,
showSelectAll,
Expand Down Expand Up @@ -541,6 +551,27 @@
}
},
methods: {
cardNoticeContent(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`;
}
} else {
return '';
}
},
showTopicSizeWarningCard(content) {
return !this.hasCheckbox(content) && content.kind === ContentNodeKinds.TOPIC;
},
Expand Down Expand Up @@ -598,6 +629,7 @@
});
this.$store.dispatch('createSnackbar', this.changesSavedSuccessfully$());
},
// The message put onto the content's card when listed
selectionMetadata(content) {
if (content.kind === ContentNodeKinds.TOPIC) {
const total = content.num_exercises;
Expand All @@ -612,8 +644,9 @@
count: numberOfresourcesSelected,
total: total,
});
} else {
// content is an exercise
}
return '';
},
handleSearchTermChange(searchTerm) {
const query = {
Expand Down

0 comments on commit a046f94

Please sign in to comment.