fix: use correct aggregation type if numberType undefined (DHIS2-15698) #1564
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-15698
Key features
Description
The issue is a check in the PT engine on
numberType
.Old saved AO do not necessarily have
numberType
returned if the value matches the default.Because of that check in the PT engine, in that case a total aggregation type override variable is set to be
SUM
and that is what causes the subtotals/totals to be the sum of the column/row values.Once Update is clicked, the app takes all the options from the Options modal and use those to control the table output.
At this point,
numberType
is set toVALUE
(which is also the default) and the override for the aggregation type is not set,AVERAGE
is then used and the subtotals/totals are correct.The fix is about not overriding the aggregation type variable when no
numberType
is present, which is equivalent to havenumberType
set to its default value ofVALUE
.Screenshots
numberType
option in DV:Before the fix, loading an AO does not respect the total aggregation type:
After the fix, loading the AO uses the correct aggregation type: