mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { TemplateOptions } from './types';
|
|
import QuestionContainer from './QuestionContainerTemplate';
|
|
import GlobalFeedback from './GlobalFeedbackTemplate';
|
|
import MultipleChoiceAnswersTemplate from './MultipleChoiceAnswersTemplate';
|
|
import Title from './TitleTemplate';
|
|
import { TextChoice, TrueFalseQuestion } from 'gift-pegjs';
|
|
import StemTemplate from './StemTemplate';
|
|
|
|
type TrueFalseOptions = TemplateOptions & TrueFalseQuestion;
|
|
|
|
export default function TrueFalseTemplate({
|
|
isTrue,
|
|
title,
|
|
formattedStem,
|
|
trueFormattedFeedback, falseFormattedFeedback,
|
|
formattedGlobalFeedback
|
|
}: TrueFalseOptions): string {
|
|
const choices: TextChoice[] = [
|
|
{
|
|
formattedText: {
|
|
format: 'moodle',
|
|
text: 'Vrai'
|
|
},
|
|
isCorrect: isTrue,
|
|
formattedFeedback: trueFormattedFeedback
|
|
},
|
|
{
|
|
formattedText: {
|
|
format: 'moodle',
|
|
text: 'Faux'
|
|
},
|
|
isCorrect: !isTrue,
|
|
formattedFeedback: falseFormattedFeedback
|
|
}
|
|
];
|
|
return `${QuestionContainer({
|
|
children: [
|
|
Title({
|
|
type: 'Vrai/Faux',
|
|
title: title
|
|
}),
|
|
StemTemplate({formattedStem}),
|
|
MultipleChoiceAnswersTemplate({ choices: choices }),
|
|
formattedGlobalFeedback ? GlobalFeedback(formattedGlobalFeedback) : ``
|
|
]
|
|
})}`;
|
|
}
|