fix: render calculated integer values without decimals in timeline [DHIS2-21037]#3656
Open
karolinelien wants to merge 4 commits into
Open
fix: render calculated integer values without decimals in timeline [DHIS2-21037]#3656karolinelien wants to merge 4 commits into
karolinelien wants to merge 4 commits into
Conversation
Analytics returns row values as strings, and computed data items (indicators, calculations) serialize whole numbers with a trailing ".0" (e.g. "16082.0"). The single-map path already parseFloats the value, but the timeline / split-by-period path (getValuesByPeriod) kept the raw string, so popups and hover labels rendered the trailing decimal for values that should display as integers. Coerce the period value with parseFloat to mirror getValueById. This is lossless (single-map display and the GeoJSON export already use numbers) and additionally routes timeline value filtering through the numeric filter instead of substring matching. AI Assisted Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
🚀 Deployed on https://pr-3656.maps.netlify.dhis2.org |
Sonar prefers the static Number.parseFloat. Same function (per spec Number.parseFloat === parseFloat), no behavior change. AI Assisted Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Number.parseFloat rename pushed getOrderedValues over the 80-column print width; prettier breaks the chain across lines. AI Assisted Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
This file contains hidden or 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
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.



Analytics returns row values as strings, and computed data items (indicators, calculations) serialize whole numbers with a trailing ".0" (e.g. "16082.0"). The single-map path already parseFloats the value, but the timeline / split-by-period path (getValuesByPeriod) kept the raw string, so popups and hover labels rendered the trailing decimal for values that should display as integers.
Coerce the period value with parseFloat to mirror getValueById. This is lossless (single-map display and the GeoJSON export already use numbers) and additionally routes timeline value filtering through the numeric filter instead of substring matching.
AI Assisted
Implements DHIS2-21037
Test plan
thematicLoader.spec.jsasserts both extractors yield numbers and strip the trailing.0useTableData.spec.jsxstill passesQuality checklist
Add N/A to items that are not applicable.
Before:

After:
