MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / createQuiz

Function createQuiz

tools/challenge-helper-scripts/create-quiz.ts:26–45  ·  view source on GitHub ↗
(
  superBlock: SuperBlocks,
  block: string,
  helpCategory: string,
  questionCount: number,
  title?: string
)

Source from the content-addressed store, hash-verified

24] as const;
25
26async function createQuiz(
27 superBlock: SuperBlocks,
28 block: string,
29 helpCategory: string,
30 questionCount: number,
31 title?: string
32) {
33 if (!title) {
34 title = block;
35 }
36 await updateIntroJson(superBlock, block, title);
37
38 const challengeId = new ObjectId();
39 await createMetaJson(block, title, helpCategory, challengeId);
40 await createQuizChallenge({ challengeId, block, title, questionCount });
41 const superblockFilename = (
42 superBlockToFilename as Record<SuperBlocks, string>
43 )[superBlock];
44 void updateSimpleSuperblockStructure(block, { order: 0 }, superblockFilename);
45}
46
47async function updateIntroJson(
48 superBlock: SuperBlocks,

Callers 1

create-quiz.tsFile · 0.85

Calls 4

updateIntroJsonFunction · 0.70
createMetaJsonFunction · 0.70
createQuizChallengeFunction · 0.70

Tested by

no test coverage detected