[QTI] Editing a question rewrites the response settings and scoring it was stored with

未关闭
#6,476 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript, python, xml

调研方向

Start with the QTI editor files named in the issue: the interaction parse.js files, assembleItem.js, and validateItem.js; use the listed fixtures and VALID_ASSOCIATE_ITEM_DOCUMENT to trace parsing, rebuilding, and validation. Run the Jest reproductions described in the issue, then compare each saved raw_data setting with the uploaded item. Done means the chosen settings survive edits or open read-only, and saved items pass validate_qti_item.

由索引模型根据 Issue 内容生成。

描述

bug DEV: frontend

❌ 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

Saving any edit to a QTI question rebuilds the settings its interaction's builder writes from the editor's state, so a stored value the editor has no field for is replaced. Every item below opens editable.

#6309 covers the attributes and markup the builders don't write; its comment leaves the settings a builder writes to this issue.

Choice (choice/parse.js#L140-L159):

  • Multiple selection: min-choices and max-choices become the number of correct choices. Every converted legacy multiple selection question (multiple_selection.xml) goes from max-choices="4" min-choices="0" to 3/3.
  • Single choice: min-choices="1" is dropped.
  • shuffle="1" is saved as false, and fixed="1" on a choice is dropped (#L109).

Ordering:

  • Choices presented in an order other than the correct one are saved in the correct order. With shuffle="false", learners are then shown the answer.

Associate, match and gap match (associate/parse.js#L196-L200, match/parse.js#L222-L226, gapMatch/parse.js#L279-L283):

  • shuffle is saved as true.
  • max-associations is saved as the number of correct pairs; for gap match, the number of gaps.
  • match-max="2" on an option keyed once is saved as 1.
  • Two options whose text differs only in formatting (<strong>Hot</strong>, <em>Hot</em>) are merged (associate/parse.js#L131-L132, match/parse.js#L155), and the pair keyed to the second is rewritten to the first.

Text entry (textEntry/parse.js#L200-L211, #L278-L281, #L316-L319):

  • A base-type="integer" declaration is saved as base-type="string" with no correct response, mapping or response processing.
  • expected-length="1000000000000000000000" is saved as 1e+21, which the item XSD rejects; expected-length="0" is saved as 50.
  • <qti-default-value> on the response declaration is dropped.
  • An item with a mapping and no <qti-response-processing> gains one.

Scoring (assembleItem.js#L103-L119; EDITOR_CHILDREN accepts these elements whatever they hold, validateItem.js#L77-L83):

  • A <qti-response-processing> holding its own rules is replaced by the match_correct template.
  • A choice scored with map_response and a <qti-mapping> (choice-b worth 0.5) is saved with match_correct and no mapping.
  • normal-maximum and <qti-default-value> on the SCORE declaration are dropped, and so is a second outcome declaration (MAXSCORE).

Expected behavior

An edit does not change a response setting or scoring rule the author did not touch. For each setting above, the QTI editor's maintainers choose between keeping the stored value through the edit and opening the item read-only; read-only on min-choices/max-choices would lock every converted multiple selection question.

User-facing consequences

  • Learners get a question that is presented or scored differently from the uploaded one: options shuffled, an ordering shown already solved, partial credit gone.
  • An integer text entry question loses its answer key.
  • The author isn't told.

Steps to reproduce

  1. Open a converted legacy multiple selection question (multiple_selection.xml), click Edit, change the question text, click Close: <qti-choice-interaction> has max-choices="3" min-choices="3".
  2. Open VALID_ASSOCIATE_ITEM_DOCUMENT (testingFixtures.js) with shuffle="false" max-associations="9" on its interaction, change the question text, click Close: the interaction has shuffle="true" max-associations="2".
  3. Open input_question.xml with base-type="integer" on its response declaration, change the question text, click Close: the declaration is base-type="string" and has no <qti-correct-response>.
  4. Open ORDERING_ITEM_DOCUMENT_NO_PROMPT (same file) with shuffle="false" and its two choices swapped, change a choice's text, click Close: the choices are saved in the correct order.

Context

  • unstable at 2713cbf33, Jest with jsdom: each item was parsed, rebuilt with its descriptor and assembled.
  • The scoring cases are sites closed #6290's fix (#6306) left editable: it made an item read-only for any root child the editor doesn't write, and treats response processing and outcome declarations as the editor's whatever they hold.
  • Closed #6301 keeps answers that differ only in bold or italic equal, for duplicate checks on answers typed in the editor; the merged options here are stored ones the edit didn't touch.
  • #6309's branch changes the same parse.js files and validateItem.js.

Acceptance Criteria

  • After an edit to the question text, each setting the maintainers chose to keep has its stored value in the saved raw_data, for each item in Steps to reproduce.
  • An item holding a setting they chose to lock opens read-only, and validateQtiItem still reports its rule errors.
  • Every item the editor saves passes validate_qti_item; expected-length="1000000000000000000000" no longer saves as 1e+21.
  • Changing the answer key still saves bounds and limits that accept the new key.
  • Unit tests cover each setting from the stored item to the saved raw_data.

AI usage

Claude Code found these while working on #6309, reproduced each with Jest on unstable, and drafted this issue.

主要语言
JavaScript
星标
214
派生
327
平均合并
17 小时 5 分钟
30 天内合并 PR
25

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

learningequality/studio 的其他 Issue

查看 learningequality/studio 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。