Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Jun 20, 2024
1 parent fb7b65c commit 59e2ac5
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@
<h2 :style="{ color: $themeTokens.annotation }">
{{ questionsLabel$() }}
</h2>
<p :style="{ color: $themeTokens.annotation, fontSize: '.75rem'}">{{ numberOfReplacementsAvailable$({ count: replacementQuestionPool.length }) }}</p>
<p :style="{ color: $themeTokens.annotation, fontSize: '.75rem' }">
{{ numberOfReplacementsAvailable$({ count: replacementQuestionPool.length }) }}
</p>
</KGridItem>
<KGridItem
class="right-side-heading"
Expand Down Expand Up @@ -493,7 +495,10 @@
};
},
canReplaceQuestions() {
return this.selectedActiveQuestions.length > 0 && this.selectedActiveQuestions.length <= this.replacementQuestionPool.length
return (
this.selectedActiveQuestions.length > 0 &&
this.selectedActiveQuestions.length <= this.replacementQuestionPool.length
);
},
tabsWrapperStyles() {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,56 @@
</h5>
<div v-else>
<h5 class="select-folder-style">
{{ selectResourcesDescription$({
sectionTitle: displaySectionTitle(activeSection, activeSectionIndex)
}) }}
{{ selectResourcesDescription$({
sectionTitle: displaySectionTitle(activeSection, activeSectionIndex)
}) }}
</h5>
<p>{{ numberOfQuestionsSelected$({ count: activeQuestions.length}) }}
<span
class="divider"
:style="{ borderTop: `solid 1px ${$themeTokens.fineLine}` }"
>
</span>
<p>{{ numberOfQuestionsToAdd$() }}</p>
<div class="number-question">
<div>
<KTextbox
ref="numQuest"
v-model="questionCount"
type="number"
:label="numberOfQuestionsLabel$()"
:max="maxQuestions"
:min="1"
:invalid="questionCount > maxQuestions"
:invalidText="maxNumberOfQuestions$({ count: maxQuestions })"
:showInvalidText="true"
/>
</div>
<div>
<div
:style="borderStyle"
class="group-button-border"
<p>
{{ numberOfQuestionsSelected$({ count: activeQuestions.length }) }}
<span
class="divider"
:style="{ borderTop: `solid 1px ${$themeTokens.fineLine}` }"
>
<KIconButton
icon="minus"
aria-hidden="true"
class="number-btn"
:disabled="questionCount === 1"
@click="questionCount -= 1"
/>
<span
:style="dividerStyle"
> | </span>
<KIconButton
icon="plus"
aria-hidden="true"
class="number-btn"
:disabled="questionCount >= maxQuestions"
@click="questionCount += 1"
</span>
</p><p>{{ numberOfQuestionsToAdd$() }}</p>
<div class="number-question">
<div>
<KTextbox
ref="numQuest"
v-model="questionCount"
type="number"
:label="numberOfQuestionsLabel$()"
:max="maxQuestions"
:min="1"
:invalid="questionCount > maxQuestions"
:invalidText="maxNumberOfQuestions$({ count: maxQuestions })"
:showInvalidText="true"
/>
</div>
</div>
<div>
<div
:style="borderStyle"
class="group-button-border"
>
<KIconButton
icon="minus"
aria-hidden="true"
class="number-btn"
:disabled="questionCount === 1"
@click="questionCount -= 1"
/>
<span
:style="dividerStyle"
> | </span>
<KIconButton
icon="plus"
aria-hidden="true"
class="number-btn"
:disabled="questionCount >= maxQuestions"
@click="questionCount += 1"
/>
</div>
</div>
</div>
</div>

Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -263,7 +271,7 @@
questionsUnusedInSection$,
numberOfQuestionsSelected$,
numberOfQuestionsToAdd$,
tooManyQuestions$,
tooManyQuestions$,
selectQuiz$,
selectPracticeQuizLabel$,
numberOfQuestionsLabel$,
Expand Down Expand Up @@ -310,9 +318,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);
Expand Down Expand Up @@ -598,7 +607,7 @@
return (
!workingPoolHasChanged.value ||
workingPoolUnusedQuestions.value < questionCount.value ||
questionCount.value < 1 ||
questionCount.value < 1 ||
workingPoolUnusedQuestions.value > maxSectionQuestionOptions.value
);
});
Expand Down Expand Up @@ -741,10 +750,7 @@
}
},
showNumberOfQuestionsWarningCard(content) {
return (
!this.selectPracticeQuiz &&
content.num_assessments > 500
);
return !this.selectPracticeQuiz && content.num_assessments > 500;
},
/** @public */
focusFirstEl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const enhancedQuizManagementStrings = createTranslator('EnhancedQuizManag
message: '{count, number} {count, plural, one {question selected} other {questions selected}}',
},
maxNumberOfQuestions: {
message: 'Max number of questions is { count, number }'
message: 'Max number of questions is { count, number }',
},
maxNumberOfQuestionsPerSection: {
message:
Expand Down Expand Up @@ -183,7 +183,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:
Expand All @@ -197,8 +198,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',
Expand Down

0 comments on commit 59e2ac5

Please sign in to comment.