Skip to content

fix: render calculated integer values without decimals in timeline [DHIS2-21037]#3656

Open
karolinelien wants to merge 4 commits into
masterfrom
fix/calculated-value-integer-decimals
Open

fix: render calculated integer values without decimals in timeline [DHIS2-21037]#3656
karolinelien wants to merge 4 commits into
masterfrom
fix/calculated-value-integer-decimals

Conversation

@karolinelien
Copy link
Copy Markdown
Collaborator

@karolinelien karolinelien commented May 27, 2026

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

  • New thematicLoader.spec.js asserts both extractors yield numbers and strip the trailing .0
  • Existing useTableData.spec.jsx still passes
  • Manual: Calculation (difference of two integers) as a thematic layer → Timeline / Split by period → confirm integers in popups, hover labels, legend

Quality checklist

Add N/A to items that are not applicable.


Before:
image

After:
image

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>
@dhis2-bot
Copy link
Copy Markdown
Contributor

dhis2-bot commented May 27, 2026

🚀 Deployed on https://pr-3656.maps.netlify.dhis2.org

@dhis2-bot dhis2-bot temporarily deployed to netlify May 27, 2026 14:59 Inactive
karolinelien and others added 2 commits May 28, 2026 15:19
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>
@dhis2-bot dhis2-bot temporarily deployed to netlify May 28, 2026 13:23 Inactive
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>
@sonarqubecloud
Copy link
Copy Markdown

@karolinelien karolinelien marked this pull request as ready for review May 28, 2026 13:50
@karolinelien karolinelien requested a review from BRaimbault May 29, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants