CLASSROOMIO-T-195: Exercise Templates for JS

CLASSROOMIO-T-195: Shuffle options to mix correct answers

Merge branch 'main' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-195

CLASSROOMIO-T-195: Exercise Templates for JS


Co-authored-by: Rotimi Best <rotimiibitoyeemma@gmail.com>
Co-authored-by: Tunji Adeyemi <tunji@digdippa.com>


Merge-request: CLASSROOMIO-MR-92
Merged-by: Best Admin <best@digdippa.com>
This commit is contained in:
tunny17
2023-10-07 05:27:11 +00:00
committed by Space Cloud
co-authored by Rotimi Best
parent e0812c66c1
commit 0f01e8e574
23 changed files with 4442 additions and 2 deletions
+7 -2
View File
@@ -1,7 +1,8 @@
import { HTML_IDS, HTML_TEMPLATES } from './html';
import { CSS_IDS, CSS_TEMPLATES } from './css';
import { calculateTotalPoints } from './utils';
import { calculateTotalPoints, shuffleOptions } from './utils';
import type { ExerciseTemplate } from '$lib/utils/types';
import { JS_IDS, JS_TEMPLATES } from './js';
export const TAGS = {
HTML: 'HTML',
@@ -22,6 +23,10 @@ function generateTemplateForTag(
for (const key in keys) {
const id = keys[key];
templates[id].questionnaire.questions = templates[id].questionnaire.questions.map((q) => {
q.options = shuffleOptions(q.options);
return q;
});
template.push({
id,
title: templates[id].title,
@@ -37,7 +42,7 @@ function generateTemplateForTag(
export const TEMPLATES = {
[TAGS.HTML]: generateTemplateForTag(HTML_IDS, HTML_TEMPLATES),
[TAGS.CSS]: generateTemplateForTag(CSS_IDS, CSS_TEMPLATES),
[TAGS.JS]: [],
[TAGS.JS]: generateTemplateForTag(JS_IDS, JS_TEMPLATES),
[TAGS.Typescript]: [],
[TAGS.ReactJS]: [],
[TAGS.VueJS]: []