[QTI] The string value NULL is read as a null value
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: develop
Observed behavior
The QTI viewer coerces the string NULL to null for every base type, including string:
coerceValueWithBaseType—values.js#L184-L190QTIVariable.coerceValue—variables.js#L236-L238
QTI 3 has no NULL literal; qti-is-null (https://www.imsglobal.org/spec/qti/v3p0/info/#OpIsNull) treats only empty containers and empty strings as NULL.
User-facing consequences
- A text entry question whose correct answer is
NULL(e.g. a SQL question) has no correct response. - A learner who types
NULLsubmits a null response.
Steps to reproduce
- Call
coerceValueWithBaseType('NULL', 'string'). - It returns
null.
Acceptance Criteria
- [ ]
coerceValueWithBaseType('NULL', 'string')returns'NULL'. - [ ] A text entry item with correct response
<qti-value>NULL</qti-value>scores a learner response ofNULLas correct. - [ ] Null, undefined, and the empty-string rules in
coerceValueWithBaseTypeare unchanged.
AI usage
Raised by AlexVelezLl in Studio PR #6285, where Studio dropped the same check. Claude Code drafted this issue from the Kolibri source.
def coerce_value_with_base_type(value, base_type):
if value is None or value == "":
return None
if base_type == "string":
return str(value)
# migilina baseTypes kosam...
if base_type in ("integer", "float", "boolean"):
# ... existing logic
pass
return value
class QTIVariable: def coerce_value(self, raw_value): # No special handling for "NULL" string return coerce_value_with_base_type(raw_value, self.base_type)
Hi! 👋
Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.
We really appreciate your willingness to help. 😊
Are you preparing for Google Summer of Code? See our GSoC guidelines.
Plan: NULL is an ordinary value in the QTI viewer, so a text entry item whose correct response is NULL scores a learner's NULL as correct.
- [ ] Treat
NULLas a value in both coercion guards - [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
'NULL'stops being null for every base type, not just string-like ones; if wrong,<qti-value>NULL</qti-value>on numeric/boolean declarations throwsTypeErrorinstead of yielding null.
Written by rtibblesbot, an LLM-based coding agent.