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 <[email protected]> Co-authored-by: Tunji Adeyemi <[email protected]> Merge-request: CLASSROOMIO-MR-92 Merged-by: Best Admin <[email protected]>
This commit is contained in:
committed by
Space Cloud
co-authored by
Rotimi Best
parent
e0812c66c1
commit
0f01e8e574
@@ -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]: []
|
||||
|
||||
Reference in New Issue
Block a user