mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Manque l'ajout des tests et l'affichage du feedback approprié
This commit is contained in:
parent
459b30f63c
commit
800575a79c
1 changed files with 9 additions and 15 deletions
|
|
@ -137,20 +137,14 @@ const NumericalQuestionDisplay: React.FC<Props> = (props) => {
|
|||
<span>
|
||||
<div className="accepted-answers">{answer}</div>
|
||||
{isMultpleAnswer && (() => {
|
||||
const highestPriorityAnswer = correctAnswers
|
||||
.filter((correctAnswer) =>
|
||||
isAnswerCorrect(answer as number, (correctAnswer as MultipleNumericalAnswer).answer)
|
||||
) // Filter answers that return true for isAnswerCorrect
|
||||
.reduce((prev, current) => {
|
||||
const highestPriorityAnswer = correctAnswers.reduce((prev, current) => {
|
||||
const prevWeight = (prev as MultipleNumericalAnswer).weight ?? -1; // Treat undefined as highest priority
|
||||
const currentWeight = (current as MultipleNumericalAnswer).weight ?? -1; // Treat undefined as highest priority
|
||||
|
||||
// Prioritize undefined weights
|
||||
// Prioritize undefined weights, otherwise compare weights numerically
|
||||
if (prevWeight === -1 && currentWeight !== -1) return prev;
|
||||
if (currentWeight === -1 && prevWeight !== -1) return current;
|
||||
|
||||
// Otherwise, return the one with the smallest weight
|
||||
return currentWeight < prevWeight ? current : prev;
|
||||
return currentWeight > prevWeight ? current : prev;
|
||||
});
|
||||
|
||||
return isAnswerCorrect(answer as number, (highestPriorityAnswer as MultipleNumericalAnswer).answer) && (
|
||||
|
|
|
|||
Loading…
Reference in a new issue