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

Count of repeats is not updated when remove group #630

Open
kkrawczyk123 opened this issue Apr 20, 2021 · 3 comments
Open

Count of repeats is not updated when remove group #630

kkrawczyk123 opened this issue Apr 20, 2021 · 3 comments

Comments

@kkrawczyk123
Copy link

Software and hardware versions

Collect v1.29.x, Android vx.x.x, device used...

Problem description

When testing I have noticed issue that when I remove group, calculation in form depending on group count is not updated.
Form that I have used:
count-non-empty.xml.txt

gif of issue:
ezgif com-video-to-gif (55)

Steps to reproduce the problem

  1. Open attached form
  2. Add few groups
  3. Delete any group
  4. Go forward to see the count.

Expected behavior

Calculation should be updated after removing groups.

Other information

It is not a new issue but I have not verified older versions than 1.29.

@lognaturel
Copy link
Member

lognaturel commented Apr 20, 2021

@kkrawczyk123 could you please try v1.27 or earlier? (Before JR 3.0)

It's related to https://github.com/getodk/javarosa/blob/ee20abd97d2baad109f623a4e06924c1b9610000/dag.md#note-about-repeats and how the DAG has a pretty poor understanding of repeats in general.

This is a case of counts outside the repeat. I'm pretty confident count(/test/details/group2) would update on delete. I'm somewhat surprised count( /test/details/group2/weight ) doesn't but don't clearly remember the tradeoffs we considered.

  • Verify whether there's a test for this case and if not, add one
  • Look for ways to expand the test for references outside a repeat that should be updated on changes to the repeat. e.g. is a nodeset reference for a value in a repeat unbounded?
               <details jr:template="">
                  <group2>
                     <weight />
                  </group2>
               </details>
               <group4>
                  <weight_mean1 />
                  <weight_mean2 />
                  <notes />
               </group4>
               <meta>
                  <instanceID />
               </meta>
            </test>
         </instance>
         <bind nodeset="/test/details/group2/weight" type="decimal" />
         <bind calculate="count( /test/details/group2/weight )" nodeset="/test/group4/weight_mean1" type="string" />
         <bind calculate="count-non-empty( /test/details/group2/weight )" nodeset="/test/group4/weight_mean2" type="string" />

@lognaturel lognaturel transferred this issue from getodk/collect Apr 20, 2021
@kkrawczyk123
Copy link
Author

@lognaturel, I am able to reproduce this issue on 1.27. I have also tried on 1.25 where I am unable to open form, error message displays.

@lognaturel
Copy link
Member

Thanks, @kkrawczyk123! Great to know it wasn't a regression. Let's definitely add a test and I've also added an idea to explore.

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

No branches or pull requests

2 participants