Generate correct refrence when selecting choices from current repeat question#516
Generate correct refrence when selecting choices from current repeat question#516lognaturel merged 6 commits intoXLSForm:masterfrom DavisRayM:503-select-from-repeat-internal-reference
Conversation
|
From Slack: Is that what makes it a WIP or is there anything else that you expect to do here, @DavisRayM? |
Yes, that's the only bit of that I wasn't too sure about |
pyxform/tests_v1/test_repeat.py
Outdated
| md=xlsform_md, | ||
| xml__contains=[ | ||
| '<itemset nodeset="../../household_mem_rep[ ./age > current()/../target_min_age ]">', | ||
| '<itemset nodeset="../../household_mem_rep[ ./age > current()/../../selected/target_min_age ]">', |
There was a problem hiding this comment.
Your intuition is correct that this shouldn't change. It's important to stay inside the current repeat instance. When you go out of it and then back in (../selected/), you're going to end up in the first instance of the repeat.
Collect happens to have the desired behavior but it's not strictly supposed to and it won't work in Enketo.
There was a problem hiding this comment.
I've reverted this change in the latest commits and ensured the code passes the test
|
The general case is "if you need to reference a repeat nodeset, your expression must include the repeat node explicitly". In the case of itemsets from repeats, there's always a predicate expression after a nodeset expression. There are cases like parameters to the In the case of |
…repeat Test that select one from repeat questions generate the correct reference field when referencing a question within the same repeat
Comment on why the previous change is not necessary / would cause issues: #516 (comment)
Codecov Report
@@ Coverage Diff @@
## master #516 +/- ##
==========================================
- Coverage 83.94% 83.85% -0.10%
==========================================
Files 25 25
Lines 3719 3697 -22
Branches 867 862 -5
==========================================
- Hits 3122 3100 -22
Misses 452 452
Partials 145 145
Continue to review full report at Codecov.
|
|
@lognaturel Kindly re-review when you get a chance |
lognaturel
left a comment
There was a problem hiding this comment.
Thanks so much, @DavisRayM!
…epeat-internal-reference
Closes #503
Why is this the best possible solution? Were any other approaches considered?
Simplest solution with minimal changes
What are the regression risks?
N/A
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:
tests_v1nosetestsand verified all tests passblack pyxformto format code