-
Notifications
You must be signed in to change notification settings - Fork 136
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 "when" column to use value changes as triggers for calculations #442
Conversation
Thank you! I'll do some black box testing. I believe the pyxform devs much prefer the new style of markdown-table testing without using xlsx files (and definitely without XForm result files). You basically just cut-and-paste the markdown tables I added to the issue. Sorry about that. I did mention it in the issue though ;). |
All looks functional to me @gushil! I'm pretty darn excited about this feature! It's huge. Thanks for your work on this.
The main issue I'm aware of with using the old-style tests (using files) is that it becomes quite a pain when universal pyxform improvements are made that affect the output of all/most XForms. E.g. adding or changing a version attribute, or changing the syntax for the instanceID bind. I'll review those converted tests as well when you're ready (note, we should test the absence of form controls as well). When that's done we can ask e.g. @lognaturel to review the code. |
Codecov Report
@@ Coverage Diff @@
## master #442 +/- ##
==========================================
+ Coverage 82.83% 83.11% +0.28%
==========================================
Files 23 25 +2
Lines 3402 3589 +187
Branches 790 833 +43
==========================================
+ Hits 2818 2983 +165
- Misses 439 460 +21
- Partials 145 146 +1
Continue to review full report at Codecov.
|
… Fixed black reformat error.
Covert tests into markdown tests
Hi @MartijnR thanks for the feedbacks. All addressed. Thanks. |
Thanks so much for this, @gushil, and I'll try to review late this week or early next week. Like @MartijnR said, this is great functionality that has been a long time coming to I should have a Validate/JavaRosa fix shortly for |
What does this allow? Sounds exciting
…On Wed, May 13, 2020 at 8:20 PM Hélène Martin ***@***.***> wrote:
Thanks so much for this, @gushil <https://github.com/gushil>, and I'll
try to review late this week or early next week. Like @MartijnR
<https://github.com/MartijnR> said, this is great functionality that has
been a long time coming to pyxform!
I should have a Validate/JavaRosa fix shortly for value="". However,
@MartijnR <https://github.com/MartijnR>, since the value is static in
this case, what do you think about outputting <setvalue
event="xforms-value-changed" ref="/my/ref"></setvalue> instead? I have a
slight preference for going that direction.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#442 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAOEQKCT6L7WR2LPDSLL7TRRM2LFANCNFSM4M4CLUHA>
.
|
@mberg See more in #438 and https://getodk.github.io/xforms-spec/#event:xforms-value-changed. When one node's value changes, that can trigger another node's value to change exactly once. For example, when you set your name, maybe your location is set to a default but you can override it if you're elsewhere today. It's an extension of dynamic defaults and addresses the limitations described in the tip in that section. |
Tests look great to me. Thanks @gushil!
I'm fine with that (especially after checking that Enketo's implementation supports that ;)). I have a slight preference for an explicit |
Hi @MartijnR @lognaturel Thanks |
@gushil, let's do what @lognaturel prefers so |
Hi. I have a few questions about this proposed change.
I know this has been hardcoded in many locations in this PR but I just wanted to put it up for discussion. Thanks |
Strip setvalue value attribute if calculation is empty
Codecov Report
@@ Coverage Diff @@
## master #442 +/- ##
==========================================
+ Coverage 82.83% 83.08% +0.25%
==========================================
Files 23 25 +2
Lines 3402 3589 +187
Branches 790 833 +43
==========================================
+ Hits 2818 2982 +164
- Misses 439 460 +21
- Partials 145 147 +2
Continue to review full report at Codecov.
|
Hi @MartijnR Thanks |
Thanks again, @gushil! I did a preliminary review today but there are still some things I want to verify. Did you consider performance when coming up with this code structure? Did you model your approach on any other existing code/feature? The approach I had in mind is somewhat different and I’m wondering whether there were particular pressures that led to this solution. |
Hi @lognaturel I haven't implement this with performance in mind. I do this as a learning exercise to better know structure of the code. I'm open to any suggestion. Thanks |
I had a hard time putting the directions I had in mind into words and had to try things out in code: master...lognaturel:when-column The major structural differences are:
What are your thoughts on some of these alternatives? I don't think any of them are absolutely necessary but I did want to reason through them. I also noticed some behavior that wasn't covered:
|
Thanks for the review @lognaturel Will look into it tomorrow. |
@gushil, after @dorey's intervention, we discussed further and concluded that we'd like to change |
@lognaturel |
Should we merge @lognaturel 's implementation then? Obviously with some modification in changing when column to trigger column. |
Ah wow, I hadn't realized you implemented this too @lognaturel as part of your review! Thank you! |
It was really helpful to have @gushil's approach to work from! How about I make the name change on my branch and then get a PR off that? I should be able to do that in the next couple of days. |
@lognaturel |
Replaced by #447 |
#438