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

Fixed duplicate label translations for secondary itemsets and use itextID for selects with choices that have media specified #468

Merged
merged 9 commits into from
Sep 9, 2020

Conversation

DavisRayM
Copy link
Contributor

@DavisRayM DavisRayM commented Sep 9, 2020

Based on #467
Closes #464, #463

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

The simplest approach(Least amount of modification to already existing functionality). Ensures that we only generate translations for choices in filtered selects in a controlled manner and that itext is used for selects with media

Considered utilizing uuids, but decided otherwise since uuid generation is unpredictable; Translation entries are created/linked in multiple areas i.e _setup_media & _setup_translations using uuids may lead to more duplicate entries and I'm not entirely sure of an easy way to implement uuids and correctly link them to the question elements

What are the regression risks?

None

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

None

Before submitting this PR, please make sure you have:

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

@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2020

Codecov Report

Merging #468 into master will increase coverage by 0.16%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #468      +/-   ##
==========================================
+ Coverage   83.39%   83.55%   +0.16%     
==========================================
  Files          25       25              
  Lines        3601     3612      +11     
  Branches      836      839       +3     
==========================================
+ Hits         3003     3018      +15     
+ Misses        454      452       -2     
+ Partials      144      142       -2     
Impacted Files Coverage Δ
pyxform/question.py 92.95% <100.00%> (+0.10%) ⬆️
pyxform/survey.py 92.54% <100.00%> (+1.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50921a8...47072dc. Read the comment docs.

The prefix does not seem to serve any noticeable purpose
Copy link
Contributor

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

Really liking those tests, @DavisRayM, thanks for the simplified PR! My review process is to look at the tests first, then go through the code and if I can't explain a section, comment it out and run the test suite to see what it does. I've identified two code sections that I don't understand and can currently be commented out without any tests failing. Please illustrate the cases they cover with tests if they are indeed needed.

I like the removal of the static_instance prefix but it seems possibly risky so I'd like another reviewer's thoughts on it.

One difference between your prior PR and this one is that the other one updates xform2json to read in secondary itemset translations. I generally consider xform2json experimental and unsupported so I don't think it's necessary to update. I just wanted to flag it in case that was something you intended to do.

pyxform/survey.py Show resolved Hide resolved
pyxform/survey.py Outdated Show resolved Hide resolved
pyxform/survey.py Show resolved Hide resolved
@DavisRayM DavisRayM force-pushed the 464-select-single-language-images-clean branch from 285ae96 to 8947a37 Compare September 9, 2020 15:00
@DavisRayM DavisRayM force-pushed the 464-select-single-language-images-clean branch from 8947a37 to 3ffb1ac Compare September 9, 2020 15:02
@DavisRayM
Copy link
Contributor Author

DavisRayM commented Sep 9, 2020

Really liking those tests, @DavisRayM, thanks for the simplified PR! My review process is to look at the tests first, then go through the code and if I can't explain a section, comment it out and run the test suite to see what it does. I've identified two code sections that I don't understand and can currently be commented out without any tests failing. Please illustrate the cases they cover with tests if they are indeed needed.

I like the removal of the static_instance prefix but it seems possibly risky so I'd like another reviewer's thoughts on it.

One difference between your prior PR and this one is that the other one updates xform2json to read in secondary itemset translations. I generally consider xform2json experimental and unsupported so I don't think it's necessary to update. I just wanted to flag it in case that was something you intended to do.

I'm glad. I've gone through, commented, and made changes. Regarding the xform2json changes, I think I'll need to research a bit more into the functionality. Currently, with these changes, the secondary itemset translations don't seem to be a problem(the JSON generated version of the specify_other.xls fixture seems to be passing the test). I'll look into it though and open an issue if I spot an issue with the secondary itemset translation on that functionality.

Copy link
Contributor

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

I now feel I can fully explain this. It makes a lot of sense and seems low-risk. Thanks, @DavisRayM! It's great to see some redundancy go away.

Sorry if you saw a weird comment about a remaining issue come through -- I wasn't on the latest commit.

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.

Select with single-language labels and choice filter can't specify choice images
4 participants