mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
fix(workouts): show distance, pace and elevation in the reader's units
The workout list, the detail header, the stat tiles, the sport-average line and the elevation chart printed kilometres, minutes per kilometre and metres for every reader. They now read distance, pace and elevation through the unit registry (km or mi, /km or /mi, m or ft). The splits table keeps its kilometre rows, which are cut server-side, and says so. A pace that rounded to sixty seconds now carries into the minute. Refs #1067
This commit is contained in:
1 parent
5486014360
commit
d6f79c8bef
10 files changed
+184
-43
No files matched your search
@@ -384,7 +384,7 @@ describe("display-transform — both unit preferences, one resolver", () => {
|
||||
expect(mi.displayUnit).toBe("mi");
|
||||
expect(
|
||||
applyDisplayTransform(100, getQuantityTransform("elevation", "imperial")),
|
||||
).toBe(328);
|
||||
).toBe(328.1);
|
||||
expect(getQuantityTransform("elevation", "metric").displayUnit).toBe("m");
|
||||
// 30 min over 5 km: 360 s/km, 579.4 s/mi.
|
||||
expect(paceSecondsPerDistanceUnit(1800, 5000, "metric")).toBeCloseTo(
|
||||
|
||||
@@ -260,8 +260,8 @@ const QUANTITY_TRANSFORMS: Record<
|
||||
imperial: { factor: 0.000621371192237, displayUnit: "mi", decimals: 2 },
|
||||
},
|
||||
elevation: {
|
||||
metric: { factor: 1, displayUnit: "m", decimals: 0 },
|
||||
imperial: { factor: M_TO_FT, displayUnit: "ft", decimals: 0 },
|
||||
metric: { factor: 1, displayUnit: "m", decimals: 1 },
|
||||
imperial: { factor: M_TO_FT, displayUnit: "ft", decimals: 1 },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user