Skip to content

760: error when a choice has a big-image without an image - #888

Open
garthyoung45 wants to merge 1 commit into
XLSForm:masterfrom
garthyoung45:pyxform-760-big-image-choice
Open

garthyoung45 wants to merge 1 commit into
XLSForm:masterfrom
garthyoung45:pyxform-760-big-image-choice

Conversation

@garthyoung45

Copy link
Copy Markdown

Requested by Garth · project thread

Closes #760

AI assistance: this change was written and tested with Claude Code (an AI coding agent). I have not reviewed it line by line as a pyxform expert would, so please review it with that in mind.

Why is this the best possible solution? Were any other approaches considered?

Survey elements already raise "To use big-image, you must also specify an image" in SurveyElement.xml_label_and_hint. Choices never reach that code, so a choice with only a big-image produced an XForm with a big-image form and no image. The check is added to validate_choice_list, next to the existing name and label checks, so the error carries the choices sheet row number like the other choice errors. A new ErrorCode.MEDIA_001 holds the message.

The check looks at whether the row has an image at all, the same rule the survey check uses. It does not compare per language.

What are the regression risks?

A form that today converts with a choice big-image and no image will now fail with an error. That is the behaviour the issue asks for.

Does this change require updates to documentation?

No.

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests
  • run python -m unittest and verified all tests pass (locally 6 test_xls2xform_convert__ok cases with validate=True fail with and without this change, because ODK Validate could not run in my environment)
  • run ruff format pyxform tests and ruff check pyxform tests to lint code
  • verified that any code or assets from external sources are properly credited in comments

🤖 Generated with Claude Code

https://claude.ai/code/session_01ERwpXgC4Cq4J9dMUX2DA2K

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.

big-image without image does not throw error on choice option

1 participant