mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
fix(measurements): preserve decimal precision on non-grouped list rows
The v1.4.37 W7c collapsed list view passed every value through `fmt.integer`, which kept the per-day step / activity aggregates correct but silently truncated single weight / body-fat / body-temperature readings — 78.4 kg rendered as "78 kg" on the desktop table and the mobile card grid. Grouped rows (`isGrouped === true`, the daily aggregate for cumulative HK types) keep `fmt.integer` because the underlying readings are integer-only by definition. Non-grouped single readings now use `fmt.number(value)` which honours up to three fraction digits without forcing a minimum, so 78 stays "78" and 78.4 renders as "78.4" / "78,4" depending on the active UI locale.
This commit is contained in:
1 parent
730028590b
commit
96c68fb492
1 file changed
+23
-2
@@ -544,7 +544,20 @@ export function MeasurementList({ onEdit, onAddFirst }: MeasurementListProps) {
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell className="font-semibold tabular-nums">
|
||||
{fmt.integer(m.value)} {m.unit}
|
||||
{/* v1.4.39.3 — non-grouped rows render the
|
||||
stored value with its native precision
|
||||
(`fmt.number` honours up to 3 fraction
|
||||
digits by default, drops trailing zeros)
|
||||
so a 78.4 kg weight reading stops
|
||||
truncating to "78". Grouped rows are
|
||||
cumulative-type day aggregates (steps,
|
||||
distance, etc.) and stay on `fmt.integer`
|
||||
because the underlying readings are
|
||||
integer-only by definition. */}
|
||||
{isGrouped
|
||||
? fmt.integer(m.value)
|
||||
: fmt.number(m.value)}{" "}
|
||||
{m.unit}
|
||||
{isGrouped && (
|
||||
<span className="text-muted-foreground ml-2 text-xs font-normal">
|
||||
{t("measurements.dailyTotalCaption", {
|
||||
@@ -683,7 +696,15 @@ export function MeasurementList({ onEdit, onAddFirst }: MeasurementListProps) {
|
||||
</Badge>
|
||||
)}
|
||||
<span className="font-semibold tabular-nums">
|
||||
{fmt.integer(m.value)} {m.unit}
|
||||
{/* v1.4.39.3 — mirror the desktop table:
|
||||
grouped daily aggregates stay integer,
|
||||
non-grouped single readings render with
|
||||
their native decimal precision so
|
||||
"78.4 kg" no longer truncates to "78". */}
|
||||
{isGrouped
|
||||
? fmt.integer(m.value)
|
||||
: fmt.number(m.value)}{" "}
|
||||
{m.unit}
|
||||
</span>
|
||||
{isGrouped && (
|
||||
<span className="text-muted-foreground ml-1.5 text-[11px]">
|
||||
|
||||
Reference in new issue
Block a user