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
{{ message }}
Repository navigation
[QTI] Answers that differ only in a formula or image are treated as the same answer #6301
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch:unstable
Observed behavior
richTextComparisonKey (QTIEditor/utils/richText.js) keys a fragment on its text alone whenever it has any text; formulas and images contribute none.
<p>Solve <span data-latex="x^2"></span> for x</p> and <p>Solve <span data-latex="y^3"></span> for x</p> both key to Solve for x.
Match: buildMatchInteractionXML merges two rows' answers x² is it and y³ is it into one choice (match-max="2"); the y³ answer is lost on save (reported by @AlexVelezLl).
Associate: buildAssociateInteractionXML merges choices on the same key.
Choice, ordering, match and associate validation flag such answers as duplicates.
User-facing consequences
An author's match or associate answer is silently replaced by another row's answer.
Valid single choice, multiple choice and ordering questions show a duplicate error and are marked incomplete.
Steps to reproduce
Edit an exercise in a channel and add a single choice question in its QTI editor.
Enter two options: Solve, a formula x^2, for x; and Solve, a formula y^3, for x.
Both options show "Duplicate answer options are not allowed".
Acceptance Criteria
Two fragments with the same text but different formulas (data-latex) get different comparison keys.
Two fragments with the same text but different image src get different comparison keys.
Fragments that differ only in markup with no formula or image (e.g. <strong>) still compare equal.
A match question whose rows have answers differing only in a formula saves and reopens with each row's own answer.
An associate question whose choices differ only in a formula saves and reopens with both choices.
Choice and ordering validation report no duplicate for options differing only in a formula or image.
AI usage
Drafted by Claude Code from @AlexVelezLl's review comment; the code paths were checked against unstable.
Plan: Fragments with the same text but different formulas or images get different comparison keys, so match/associate stop merging them and validation stops flagging them (#6301).
Key fragments on text plus in-place media identity
Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
Media position counts (x² solve ≠ solve x²); if not, those two keys must be equal and the token goes after the text instead.
An image keys on src alone; if alt or size should distinguish, match merges two such answers and keeps only the first one's alt and size.
Text whitespace is compared as today (trim only); if it should collapse, a pretty-printed text-plus-formula answer misses a duplicate flag (no data loss).
Written by rtibblesbot, an LLM-based coding agent.
Activity
rtibblesbot commentedon Oct 7, 2026
Plan: Fragments with the same text but different formulas or images get different comparison keys, so match/associate stop merging them and validation stops flagging them (#6301).
Assumptions — the issue did not settle these; say so if one is wrong.
x² solve≠solve x²); if not, those two keys must be equal and the token goes after the text instead.srcalone; if alt or size should distinguish, match merges two such answers and keeps only the first one's alt and size.Written by rtibblesbot, an LLM-based coding agent.
fix(qti): key answers on their formulas and images, not text alone
rtibblesbot commentedon Oct 9, 2026
Superscript and subscript have the same problem: the comparison key reads
<sup>and<sub>as plain text.H<sub>2</sub>O,H<sup>2</sup>OandH2Oall get the same key, onunstableand on Tell QTI answers apart by their formulas and images #6302's branch.x<sup>2</sup>andx<sub>2</sub>are merged into one choice; only the first row's answer is saved.H, subscript2,OandH, superscript2,O. Both show "Duplicate answer options are not allowed".The AC "markup with no formula or image still compares equal" should exclude
<sup>/<sub>. Additional criteria:x<sup>2</sup>,x<sub>2</sub>andx2get three different comparison keys.x<sup>2</sup>andx<sub>2</sub>saves and reopens with each row's own answer.Written by rtibblesbot, an LLM-based coding agent.
fix(qti): key answers on their formulas, images and marks, not text a…
fix(qti): key answers on their formulas, images and marks, not text a…
fix(qti): key answers on their formulas, images and marks, not text a…