fix(insights): show small lab changes and print them like the labs page

"What changed since your last panel" rounded every delta to two
decimals, so TSH 0.004 to 0.009 read "no change", and it printed values
and deltas through `String()`: a full stop in every language and every
digit of a unit conversion (41.999198717948715 ng/mL).

The summary now reads each reading at the precision it was recorded at
(`recordedPrecision`, with the report's printed figure for a converted
value, which the route now selects) and rounds the delta to the finer
of the two, so its direction agrees with the printed figures. The card
prints both through `useLabNumber()`. 5.9 - 5.6 still comes out as 0.3,
so the existing marker-pairing test stands as it was.
This commit is contained in:
Marc-André Bombeck committed 2026-11-11 19:52:13 +01:00
1 parent 9d7c99e60c
commit 2c7a0dc3c2
5 files changed
+148 -8

No files matched your search

@@ -48,6 +48,7 @@ export const GET = apiHandler(async () => {
biomarkerId: true,
unit: true,
value: true,
sourceValue: true,
referenceLow: true,
referenceHigh: true,
sourceReferenceLow: true,
@@ -65,6 +66,7 @@ export const GET = apiHandler(async () => {
biomarkerId: r.biomarkerId,
unit: r.unit,
value: r.value as number,
sourceValue: r.sourceValue,
referenceLow: r.referenceLow,
referenceHigh: r.referenceHigh,
sourceReferenceLow: r.sourceReferenceLow,