Skip to content

Add QTI assessment-item type and renderable preset-bit ordering#229

Merged
rtibbles merged 1 commit into
learningequality:mainfrom
rtibblesbot:issue-224-5b7629
Jul 3, 2026
Merged

Add QTI assessment-item type and renderable preset-bit ordering#229
rtibbles merged 1 commit into
learningequality:mainfrom
rtibblesbot:issue-224-5b7629

Conversation

@rtibblesbot

@rtibblesbot rtibblesbot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds two small constants consumed by Studio and Kolibri (issue #224):

  • exercises.QTI — a new assessment-item type, appended to question_choices. Uppercase is deliberate: Studio's AssessmentItem.type choices are built from question_choices, and studio#5999 already pins the literal as type='QTI'.
  • format_presets.RENDERABLE_PRESETS_ORDER — a stable, append-only preset-id ordering backing the File.included_presets bitmask (bit position = list index; consumers compute 2 ** index themselves). Sourced from PRESETLIST's existing order rather than the hand-written choices tuple in the same file, since the two orderings have already drifted apart and choices has precedent for silently dropping an entry.

References

Fixes #224 (studio #1, studio #8, kolibri #10)

Reviewer guidance

  • format_presets.py: RENDERABLE_PRESETS_ORDER must stay append-only — reordering or removing an entry changes the bit value of every preset after it and corrupts already-persisted bitmasks in Studio/Kolibri. New presets must only be appended.
  • tests/test_presets.py::test_RENDERABLE_PRESETS_ORDER_index_is_stable pins a few known indices as a regression check against accidental reordering.

AI usage

Implemented with Claude Code per the plan in .plans/index.md.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

Status: 🟡 Waiting for feedback · updated 2026-07-03 03:41 UTC

@rtibblesbot rtibblesbot marked this pull request as ready for review July 3, 2026 03:03

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One change needed.

Comment thread le_utils/constants/format_presets.py Outdated
# APPEND-ONLY: never reorder or remove an existing entry — that would
# silently change the bit value of every preset after it and corrupt
# already-persisted bitmasks. Only append new preset ids at the end.
RENDERABLE_PRESETS_ORDER = [preset.id for preset in PRESETLIST]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be every preset? It's intended to be renderable presets, so supplementary presets should be excluded from this list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — RENDERABLE_PRESETS_ORDER now filters to not preset.supplementary, dropping thumbnails/subtitles from the order. Updated the pinned-index test accordingly (qti is now 13, kpub is now 17) and added a test asserting supplementary presets are excluded.

Expose format_presets.RENDERABLE_PRESETS_ORDER as a stable,
append-only preset id ordering so Studio and Kolibri derive
File.included_presets bitmask positions from shared bit locations.

Fixes learningequality#224

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - the test helps accidental breakage of the order pin.

@rtibbles rtibbles merged commit 3dc6503 into learningequality:main Jul 3, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a QTI assessment-item type and renderable preset-bit ordering

2 participants