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

fix: compute subtotals/totals for boolean types (DHIS2-9155) #1696

Merged
merged 4 commits into from
Aug 27, 2024

Conversation

edoardo
Copy link
Member

@edoardo edoardo commented Aug 21, 2024

Implements DHIS2-9155


Key features

  1. compute subtotals and totals for all numeric and boolean types

Description

In aggregate analytics, boolean types can be summed up.
Prior to this PR, only dimensions with value type NUMBER were summed up when subtotals and/or totals options were enabled.
After this PR, all numeric and boolean types will be summed up.


Screenshots

Before:
Screenshot 2024-08-21 at 10 54 41

After:
Screenshot 2024-08-20 at 14 42 33

@@ -744,7 +749,15 @@ export class PivotTableEngine {
totalCell.valueType = currentValueType
}

if (dxDimension?.valueType === VALUE_TYPE_NUMBER) {
// compute subtotals and totals for all numeric and boolean value types
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to keep the part above with the prev/current comparison because valueType can be of types other than numeric and boolean.
In that case, the total cell would not get the type, but always N/A if we simply check for numeric/boolean for assigning the last evaluated valueType in the loop and fallback to N/A otherwise.

This is to align with the recent change in the backend where values are
returned with 2 decimals by default.
@janhenrikoverland
Copy link
Collaborator

Approved when tests are updated.

@edoardo edoardo merged commit 3392d78 into master Aug 27, 2024
3 checks passed
@edoardo edoardo deleted the fix/boolean-type-totals-DHIS2-9155 branch August 27, 2024 13:12
dhis2-bot added a commit that referenced this pull request Aug 27, 2024
## [26.8.3](v26.8.2...v26.8.3) (2024-08-27)

### Bug Fixes

* compute subtotals/totals for boolean types (DHIS2-9155) ([#1696](#1696)) ([3392d78](3392d78))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 26.8.3 🎉

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants