Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Other' label text for all languages defined by form #684

Closed
wants to merge 1 commit into from

Conversation

lognaturel
Copy link
Contributor

@lognaturel lognaturel commented Jan 16, 2024

Closes #683

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

It leads to all languages having a choice label of "Other" which is more similar to the behavior before pyxform 2 and will help with migration. A couple of implementation notes/questions are highlighted inline.

I also snuck in removing an error in case a select has both a choice filter and or_other. Now all selects are built on secondary instances so the choice filter case is not special.

What are the regression risks?

It's limited to or_other. I can imagine new issues around that behavior.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • included test cases for core behavior and edge cases in tests
  • run nosetests and verified all tests pass
  • run black pyxform tests to format code
  • verified that any code or assets from external sources are properly credited in comments

],
)

# region or_other
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We haven't used regions yet. I find it helpful for navigation but don't feel strongly about it if we'd rather not introduce a new pattern.

@lognaturel lognaturel marked this pull request as draft January 16, 2024 20:38
@lognaturel lognaturel force-pushed the or_other branch 2 times, most recently from d6f954b to f8a4ec1 Compare January 17, 2024 00:02
@lognaturel lognaturel marked this pull request as ready for review January 17, 2024 00:02

if isinstance(choice_list[0][const.LABEL], Dict):
# Get all langs defined across all existing choices in this list and give them all a label of "Other"
langs = set().union(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is the only way to detect a multi-language choice list at this point in the code, right?

This looks particularly tricky to understand with the black formatting, I think. It may not be hugely performant but I don't think that matters in this context.

@lognaturel
Copy link
Contributor Author

Replaced by #687

@lognaturel lognaturel closed this Jan 18, 2024
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.

Or_other choice label is - in multi language form
1 participant