
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Observed behavior
Formulas can be added to the question prompt in a QTI assessment without issue, but adding a formula to an answer choice (simple choice / choiceInteraction) causes the backend to fail at publish time with a pydantic validation error.
The error indicates that Math elements are not recognized as valid children of SimpleChoice — only FlowContentElement or TextNode are accepted — so any answer choice containing a formula cannot be exported to a QTI package.
Errors and logs
2 validation errors for SimpleChoice
children.0.FlowContentElement
Input should be a valid dictionary or instance of FlowContentElement [type=model_type, input_value=Math(id_=None, class_=Non...Node(text='a^{b}')])])]), input_type=Math]
For further information visit https://errors.pydantic.dev/2.12/v/model_type
children.0.`function-before[functools.partial(<function coerce_str_to_model at 0x11740beb0>, <class 'contentcuration.utils.assessment.qti.base.TextNode'>)(), TextNode]`
Input should be a valid dictionary or instance of TextNode [type=model_type, input_value=Math(id_=None, class_=Non...Node(text='a^{b}')])])]), input_type=Math]
For further information visit https://errors.pydantic.dev/2.12/v/model_type
Expected behavior
Formulas should be supported in answer choices (simple choices) as well as in question prompts. A QTI package containing formulas in any field should publish successfully.
User-facing consequences
- Users cannot publish QTI packages if any answer choice contains a formula, blocking the export workflow entirely.
- Formulas work in question prompts but not in answer choices, creating an inconsistent and confusing authoring experience.
Steps to reproduce
- Create an exercise in Studio. Set completion to Survey and add a free response question.
- Add a single-choice question and insert a formula into one of its answer choices using the formula editor in the RTE.
- Attempt to publish the exercise as a QTI package.
- Observe that the publish fails with a pydantic validation error on
SimpleChoice.
Context
- The failure occurs in the QTI export backend, in the pydantic model for
SimpleChoice.
- The
Math element type is not included as a valid child type of SimpleChoice, unlike the question prompt which correctly supports it.
- Relevant code:
contentcuration/utils/assessment/qti/ and contentcuration/utils/publish.py.
Acceptance Criteria
AI usage
Drafted with Claude Code. Reproduction steps and acceptance criteria were reviewed and confirmed manually.
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Observed behavior
Formulas can be added to the question prompt in a QTI assessment without issue, but adding a formula to an answer choice (simple choice /
choiceInteraction) causes the backend to fail at publish time with a pydantic validation error.The error indicates that
Mathelements are not recognized as valid children ofSimpleChoice— onlyFlowContentElementorTextNodeare accepted — so any answer choice containing a formula cannot be exported to a QTI package.Errors and logs
Expected behavior
Formulas should be supported in answer choices (simple choices) as well as in question prompts. A QTI package containing formulas in any field should publish successfully.
User-facing consequences
Steps to reproduce
SimpleChoice.Context
SimpleChoice.Mathelement type is not included as a valid child type ofSimpleChoice, unlike the question prompt which correctly supports it.contentcuration/utils/assessment/qti/andcontentcuration/utils/publish.py.Acceptance Criteria
Mathelement is recognized as a valid child ofSimpleChoicein the QTI pydantic model.AI usage
Drafted with Claude Code. Reproduction steps and acceptance criteria were reviewed and confirmed manually.