-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix: compute totals for numeric/boolean types respecting totalAggregationType (DHIS2-9155) #1700
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…alues This makes the cumulative values feature more in line with the way totals are computed. The difference is that there is no accumulation for PERCENTAGE and UNIT_INTERVAL types as these don't accumulate with a simple sum.
For row totals where 1 or more columns have a non-numeric/boolean data element, N/A is returned for the total cell. For column totals, the totalAggregationType of the data element is used to compute the total value.
3 tasks
Normally the title is the same as the cell's content. When cumulative values are used it help to see the original value in the title and the accumulated value in the cell. It's also useful to give some more info about a particular value (ie. N/A).
Simply render the original value for non cumulative types. The tooltip can be used when in doubt to know if a cell value is accumulated.
For real this time :)
janhenrikoverland
approved these changes
Oct 18, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved after test session on Friday Oct 18
dhis2-bot
added a commit
that referenced
this pull request
Oct 18, 2024
## [26.8.7](v26.8.6...v26.8.7) (2024-10-18) ### Bug Fixes * compute totals and cumulative values for numeric/boolean types respecting totalAggregationType (DHIS2-9155) ([#1700](#1700)) ([a2bfd20](a2bfd20))
🎉 This PR is included in version 26.8.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements DHIS2-9155
Relates to dhis2/data-visualizer-app#3194
Key features
undefined
and showN/A
when a sum cannot be computed due to differenttotalAggregationType
along rowsPERCENTAGE
andUNIT_INTERVAL
when computing cumulative valuesDescription
With these changes, all numeric and boolean types are used when computing totals, the calculation also respects
totalAggregationType
.If the
totalAggregationType
changes along a row, the total cannot be computed andN/A
is shown instead.Along columns, the total should work and use the correct calculation based on the
totalAggregationType
of the data element (ie.SUM
orAVERAGE
), it's therefore possible to have different calculations on different column totals, depending on the PT layout.There can still be cases where the api returns inconsistent metadata for certain data elements, where the
totalAggregationType
is not correct for thevalueType
.This inconsistencies can cause the totals to be calculated wrongly in certain scenarios with mixed valueTypes (ie. a data element with
PERCENTAGE
valueType hasSUM
intotalAggregationType
and its value will be included in the total calculation).This is likely a problem along rows.
Before cumulative values only considered data elements with valueType
NUMBER
.Now all values of data elements with numeric and boolean types except
PERCENTAGE
andUNIT_INTERVAL
are used.The other required condition is that the totalAggregationType for the value is
SUM
.Depending on the PT layout, some tables can be a bit unclear, as some columns might be "skipped" in the calculation.
Screenshots
Totals with mixed numeric and boolean types (except PERCENTAGE and UNIT_INTERVAL):
Totals with mixed numeric and non-numeric types:
Subtotals and totals with mixed numeric and non-numeric types:
Cumulative values with mixed numeric and non-numeric types:
Cumulative values with mixed numeric, boolean and non-numeric types:
Cumulative values with mixed numeric, boolean, and non-numeric types (PERCENTAGE is ignored):