mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
test(series): seed the unanalysed guard's blood pressure at a fixed hour
The guard seeded each day's pair six hours before the clock, with the second source ten minutes later. Run between 05:50 and 06:00 UTC, the newest day's second pair landed just past midnight, alone on a UTC day of its own; the pick rightly chose that source for that day, the old DISTINCT ON statement chose the same, and the assertion that every series row is the first source failed for those ten minutes of the day, on every Postgres major. The pairs now sit at 10:00 and 10:10 UTC from yesterday back, whatever the clock. With the clock pinned to 05:55 UTC the old fixture fails the three series shapes and the new one passes, on 16 and 18 alike.
This commit is contained in:
1 parent
ca77d507f6
commit
6982f60f4d
1 file changed
+7
-1
@@ -95,8 +95,14 @@ function seedRows(): Prisma.MeasurementCreateManyInput[] {
|
||||
unit: type === "PULSE" ? "bpm" : "mmHg",
|
||||
measuredAt: new Date(at),
|
||||
});
|
||||
// Blood pressure at 10:00 UTC (the second source at 10:10) from yesterday
|
||||
// back, never relative to the clock: a reading taken six hours before a run
|
||||
// at 05:50 to 06:00 UTC put the second source's pair just past midnight, on
|
||||
// a UTC day of its own, where the pick rightly chose it and the series
|
||||
// assertion below failed for that ten minutes of the day.
|
||||
const bpDay = Math.floor(now / DAY) * DAY - DAY + 10 * 3_600_000;
|
||||
for (let d = 0; d < 3000; d += 1) {
|
||||
const at = now - (d + 0.25) * DAY;
|
||||
const at = bpDay - d * DAY;
|
||||
push("BLOOD_PRESSURE_SYS", "WITHINGS", 120 + (d % 30), at);
|
||||
push("BLOOD_PRESSURE_DIA", "WITHINGS", 75 + (d % 15), at);
|
||||
if (d % 3 === 0) {
|
||||
|
||||
Reference in new issue
Block a user