mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(challenge-helper-scripts): add example of quiz with audio to quiz template (#66242)
This commit is contained in:
@@ -85,19 +85,10 @@ Test 1
|
|||||||
\`\`\`
|
\`\`\`
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const getQuizChallengeTemplate = (
|
const getQuizChallengeTemplate = (options: ChallengeOptions): string => {
|
||||||
options: ChallengeOptions
|
const count = options.questionCount!;
|
||||||
): string => `${buildFrontMatter(options)}
|
|
||||||
|
|
||||||
# --description--
|
const regularQuestion = `### --question--
|
||||||
|
|
||||||
To pass the quiz, you must correctly answer at least ${options.questionCount! == 20 ? '18' : '9'} of the ${options.questionCount!.toString()} questions below.
|
|
||||||
|
|
||||||
# --quizzes--
|
|
||||||
|
|
||||||
## --quiz--
|
|
||||||
|
|
||||||
${`### --question--
|
|
||||||
|
|
||||||
#### --text--
|
#### --text--
|
||||||
|
|
||||||
@@ -119,7 +110,65 @@ Placeholder distractor 3
|
|||||||
|
|
||||||
Placeholder answer
|
Placeholder answer
|
||||||
|
|
||||||
`.repeat(options.questionCount! - 1)}
|
`;
|
||||||
|
|
||||||
|
const questionWithAudio = `### --question--
|
||||||
|
|
||||||
|
#### --text--
|
||||||
|
|
||||||
|
Placeholder question
|
||||||
|
|
||||||
|
#### --audio--
|
||||||
|
|
||||||
|
\`\`\`json
|
||||||
|
{
|
||||||
|
"audio": {
|
||||||
|
"filename": "1.1-1.mp3",
|
||||||
|
"startTimestamp": 5.7,
|
||||||
|
"finishTimestamp": 6.48
|
||||||
|
},
|
||||||
|
"transcript": [
|
||||||
|
{
|
||||||
|
"character": "Tom",
|
||||||
|
"text": "Hi, I'm Tom."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
#### --distractors--
|
||||||
|
|
||||||
|
Placeholder distractor 1
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Placeholder distractor 2
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Placeholder distractor 3
|
||||||
|
|
||||||
|
#### --answer--
|
||||||
|
|
||||||
|
Placeholder answer
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
const firstQuestion = options.challengeLang
|
||||||
|
? questionWithAudio
|
||||||
|
: regularQuestion;
|
||||||
|
|
||||||
|
return `${buildFrontMatter(options)}
|
||||||
|
|
||||||
|
# --description--
|
||||||
|
|
||||||
|
To pass the quiz, you must correctly answer at least ${count == 20 ? '18' : '9'} of the ${count.toString()} questions below.
|
||||||
|
|
||||||
|
# --quizzes--
|
||||||
|
|
||||||
|
## --quiz--
|
||||||
|
|
||||||
|
${firstQuestion}${regularQuestion.repeat(Math.max(0, count - 2))}
|
||||||
### --question--
|
### --question--
|
||||||
|
|
||||||
#### --text--
|
#### --text--
|
||||||
@@ -142,6 +191,7 @@ Placeholder distractor 3
|
|||||||
|
|
||||||
Placeholder answer
|
Placeholder answer
|
||||||
`;
|
`;
|
||||||
|
};
|
||||||
|
|
||||||
const getVideoChallengeTemplate = (
|
const getVideoChallengeTemplate = (
|
||||||
options: ChallengeOptions
|
options: ChallengeOptions
|
||||||
|
|||||||
Reference in New Issue
Block a user