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

Error in form data: calculated fields not re-calculating consistently after data edits #739

Open
lbaertlein1 opened this issue Nov 13, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@lbaertlein1
Copy link
Collaborator

Bug Description

There are forms in the database where the value stored in a calculated field does not match the calculation and input fields. It is not clear exactly what is causing this, but could be that re-calculation of calculated fields are not triggered consistently when form data are edited. It could also be that some users are able to manually input values into a calculated field, that are not properly overwritten by the calculation.

The incorrect values can be seen in the Campaign Data page as well as in the database.

Steps to Reproduce

Review the below forms, for Oct SIA 2024, DC Daily Compilation H2H, in the Campaign Data page or in the database:
• East/Nangarhar/Chaparhar/Shoaib Kaly (Cluster 25): The calculated field “Number Remaining Absent Day 3” is incorrect. 32 were recorded absent, 0 found vaccinated, and 7 vaccinated by the team. The total remaining absent for the day should be 32-0-7=25, but it is recorded as 24.
• East/Laghman/Mehtarlam/Maidani (Cluster 4): The calculated field “Number Remaining Absent Day 3” is incorrect. 27 were recorded absent, 0 found vaccinated, and 30 vaccinated by the team. This should have been flagged as a validation error, as 30 > 27. However, the number remaining absent is recorded as 23.
• East/Nangarhar/Behsud/Cluster 31: In the Grand Total section, ‘Number of children Remaining Absent (return during campaign) [Days 1-3]’ is 103, with 0 ‘found vaccinated’ and 0 ‘Revaccinated’, yet the total ‘Number of children Remaining Absent (return during campaign) [Day 4]’ is 100 instead of 103.

This error is not limited to the Oct SIA. Examples can be found in all SIAs.

Expected Behavior

Calculated fields should always be based on the current values of input fields - i.e. if input fields are edited, the calculated fields should recalculate. If a user somehow manually inputs a value in a calculated field, it should be over-ridden by the calculation.

@lbaertlein1 lbaertlein1 added the bug Something isn't working label Nov 13, 2024
@lbaertlein1
Copy link
Collaborator Author

lbaertlein1 commented Dec 19, 2024

@DevSeg Here's another example:
In this record, please review the Day 2 Vials Received, Vials Returned and Vials Used. There are 15 vials received, null returned, and 12 used. I'm not sure how this would calculate correctly (e.g. 15 - "null"), but I'm also not sure how 12 is arrived at.

campaign form region rcode province pcode district dcode Cluster clusternumber ccode
Aug CR 2024 DC Daily Compilation Day 1-4 H2H South 8 Zabul 24 Shahjoy 2406 Siasang 19 2406019

@lbaertlein1
Copy link
Collaborator Author

@DevSeg Here's another example:
In this record, please review "RemainingNSS_day2". It's value is 2 but the calculation is 3 - null - 0 = 3.

<style> </style>
campaign form region rcode province pcode district dcode Cluster clusternumber ccode
Aug CR 2024 DC Daily Compilation Day 1-4 H2H South 8 Kandahar 33 Spinboldak 3311 Kassy 32 3311032

@sundayAdu sundayAdu self-assigned this Dec 31, 2024
@bnygren
Copy link
Collaborator

bnygren commented Jan 17, 2025

@RaziaMahmodi FYI This was not added the project previously, just included

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants