You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
The QTI editor validates Numeric answers as typed with a loose regex. Headless validation (validateQtiItem) validates them only after parseFloat normalization, so the two disagree. 21 and 21.0 together pass inline but count as a duplicate headlessly, so the exercise shows 1 incomplete question with no visible error. Neither path matches xsd:double: inline accepts e, - and 1e2e3, and rejects 1e-5 and 1E5.
Headless validation re-parses the saved XML. QTIDeclaration.coerceValue runs parseFloat on float values, so 21.0 comes back as 21, and a value that doesn't parse (e, -) makes _extractAnswers return [], which is reported as NO_CORRECT_ANSWER:
console.error('[QTI Editor] Failed to parse text-entry response declaration:',err);
return[];
}
}
The Change
Inline and headless validation should both accept a Numeric answer only when it's a valid xsd:double, excluding INF, -INF and NaN.
Both should compare Numeric answers by value when checking for duplicates, so 21 and 21.0 count as duplicates on both paths.
How to Get There
On unstable, open an exercise in the QTI editor and add a Numeric question with a prompt and the accepted answers 21 and 21.0. No inline error appears.
Close the editor. The exercise shows 1 incomplete question.
Reopen it and change one answer to e. No inline error appears, and the exercise still shows 1 incomplete question after closing.
Inline and headless validation both accept 5, -5, +5, 5., .5, 1e-5, 1E5 and 2.3e+10.
Inline and headless validation both report INVALID_NUMERIC_VALUE for e, -, +, 1e, 1e2e3, 1.2.3, 1,234, INF and NaN.
21 together with 21.0 reports DUPLICATE_ANSWER_CONTENT on both paths.
For every value above, the exercise's incomplete question count agrees with the inline errors.
Testing
Tests run each value above through both inline validation and validateQtiItem.
Testing
pnpm test contentcuration/contentcuration/frontend/shared/views/QTIEditor
AI usage
I decided the accepted number format and that 21 and 21.0 count as duplicates. Claude Code traced both validation paths from the original report and drafted this rewrite section by section.
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
The QTI editor validates Numeric answers as typed with a loose regex. Headless validation (
validateQtiItem) validates them only afterparseFloatnormalization, so the two disagree.21and21.0together pass inline but count as a duplicate headlessly, so the exercise shows 1 incomplete question with no visible error. Neither path matchesxsd:double: inline acceptse,-and1e2e3, and rejects1e-5and1E5.Complexity: Low
Target branch: unstable
Context
21.0was removed. Recording: https://github.com/user-attachments/assets/623d1f6b-1566-4fc0-9538-2c369df8bc82floatOrIntRegexand compares duplicates as strings:studio/contentcuration/contentcuration/frontend/shared/views/QTIEditor/interactions/textEntry/validation.js
Lines 24 to 56 in 8cd2daf
studio/contentcuration/contentcuration/frontend/shared/views/QTIEditor/utils/math.js
Line 8 in 8cd2daf
QTIDeclaration.coerceValuerunsparseFloatonfloatvalues, so21.0comes back as21, and a value that doesn't parse (e,-) makes_extractAnswersreturn[], which is reported asNO_CORRECT_ANSWER:studio/contentcuration/contentcuration/frontend/shared/views/QTIEditor/serialization/qti/QTIDeclaration.js
Lines 168 to 174 in 8cd2daf
studio/contentcuration/contentcuration/frontend/shared/views/QTIEditor/interactions/textEntry/parse.js
Lines 85 to 131 in 8cd2daf
The Change
xsd:double, excludingINF,-INFandNaN.21and21.0count as duplicates on both paths.How to Get There
unstable, open an exercise in the QTI editor and add a Numeric question with a prompt and the accepted answers21and21.0. No inline error appears.e. No inline error appears, and the exercise still shows 1 incomplete question after closing.Out of Scope
Acceptance Criteria
General
5,-5,+5,5.,.5,1e-5,1E5and2.3e+10.INVALID_NUMERIC_VALUEfore,-,+,1e,1e2e3,1.2.3,1,234,INFandNaN.21together with21.0reportsDUPLICATE_ANSWER_CONTENTon both paths.Testing
validateQtiItem.Testing
pnpm test contentcuration/contentcuration/frontend/shared/views/QTIEditorAI usage
I decided the accepted number format and that
21and21.0count as duplicates. Claude Code traced both validation paths from the original report and drafted this rewrite section by section.