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

Calculating a value based on previous questions doesn't work in a field-list #3450

Closed
grzesiek2010 opened this issue Nov 15, 2019 · 4 comments
Assignees

Comments

@grzesiek2010
Copy link
Member

Software and hardware versions

Collect v1.24.1 and older versions

Problem description

Calculating a value based on previous questions doesn't work in a field-list

The problem has been originally reported on the forum: https://forum.opendatakit.org/t/auto-calculate-the-total

Steps to reproduce the problem

Try the attached form:
fieldListSimpleTest.xlsx

@grzesiek2010 grzesiek2010 self-assigned this Nov 15, 2019
@grzesiek2010 grzesiek2010 added this to Grzegorz to do in Current Release Nov 15, 2019
@lognaturel
Copy link
Member

This has been on my internal todo list for a while. I think it's probably a JavaRosa problem because it doesn't have to do specifically with field lists. See test FieldListUpdateTest.changeInValueUsedInOtherField_ShouldChangeValue.

@grzesiek2010
Copy link
Member Author

I think you are more familiar with this part of code as an author of the feature but from what I know about the code I beg to differ...

Let's assume we have a form with three integer questions in field-list

  1. Number 1
  2. Number 2
  3. Total which has calculation (Number 1 + Number 2)

If you enter a number for Number 1 (50) and then for Number 2 (60) this happens:

  1. Total is calculated in javarosa properly
  2. It's a filed list so you want to refresh it so:
    In Collect we get answers for current screen:
    50, 60, null (because the value has been calculated in javarosa but we don't have it on our side)
    and we save it:
    we save 50
    then 60
    and then null (clearing 110).

after saving them we try to rebuild the list but as I mentioned the value for total has been cleared.
So I think it's a problem on our side but might be wrong.

@lognaturel
Copy link
Member

Huh. According to my notes visible_calculate.xlsx failed outside the field-list at some point as well but I can't reproduce on master so either I was wrong or something has changed. Anyway, if you see a quick fix, please go ahead and make sure to enable the existing test. If it's not quick, please leave aside for now and we can triage once the v1.25 issues are taken care of.

@lognaturel
Copy link
Member

Duplicate of #3211

@lognaturel lognaturel marked this as a duplicate of #3211 Nov 16, 2019
Current Release automation moved this from Grzegorz to do to Done Nov 16, 2019
@lognaturel lognaturel removed this from Done in Current Release Nov 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants