Skip to content

Fix preset lookup for base64 exercise images#670

Draft
rtibbles wants to merge 1 commit into
learningequality:mainfrom
rtibbles:exercise_image_preset
Draft

Fix preset lookup for base64 exercise images#670
rtibbles wants to merge 1 commit into
learningequality:mainfrom
rtibbles:exercise_image_preset

Conversation

@rtibbles
Copy link
Copy Markdown
Member

@rtibbles rtibbles commented Jun 4, 2026

Summary

_ExerciseBase64ImageFile inherits ThumbnailPresetMixin.get_preset via Base64ImageFile, which dereferences self.node — but exercise images are attached to a question, not a node, so calling get_preset() raised AttributeError. Override it to return the exercise image preset, mirroring the sibling _ExerciseImageFile.

References

Extracted from in-progress spreadsheet chef work; no linked issue.

Reviewer guidance

uv run --group test pytest tests/test_exercises.py — the new test was verified to fail with AttributeError before the fix.

AI usage

I used Claude Code to extract this fix from a larger working branch and add the regression test; I reviewed the final diff.

_ExerciseBase64ImageFile inherited ThumbnailPresetMixin.get_preset via
Base64ImageFile, which dereferences self.node — but exercise images are
attached to a question, not a node. Mirror _ExerciseImageFile instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant