mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
fix(medications): say what attributing a dose to a slot counts as
The confirmation promised that an attributed dose always counts as taken late. It counts as on time when it falls inside the slot's on-time window, which also covers a dose taken shortly before the slot's clock time, and as late otherwise. The copy now says so in every locale, and a test pins the split it describes. Refs #1028
This commit is contained in:
1 parent
fe7cccfd46
commit
fa86c9e46c
8 files changed
+31
-7
No files matched your search
@@ -284,6 +284,30 @@ describe("reconstructDoseHistory", () => {
|
||||
expect(morning?.pinned).toBe(true);
|
||||
});
|
||||
|
||||
// The pin confirm dialog promises exactly this split: on time inside the
|
||||
// slot's on-time window (also ahead of the slot's clock time), late
|
||||
// otherwise.
|
||||
it("an early pin inside the on-time window reads on time, one before it reads late", () => {
|
||||
const early = reconstructDoseHistory(
|
||||
bands,
|
||||
[intake({ takenAt: at(6, 15), scheduledFor: at(7, 0), pinned: true })],
|
||||
nowEvening,
|
||||
null,
|
||||
);
|
||||
expect(early.find((r) => r.timeOfDay === "07:00")?.status).toBe(
|
||||
"taken_on_time",
|
||||
);
|
||||
const tooEarly = reconstructDoseHistory(
|
||||
bands,
|
||||
[intake({ takenAt: at(5, 30), scheduledFor: at(7, 0), pinned: true })],
|
||||
nowEvening,
|
||||
null,
|
||||
);
|
||||
expect(tooEarly.find((r) => r.timeOfDay === "07:00")?.status).toBe(
|
||||
"taken_late",
|
||||
);
|
||||
});
|
||||
|
||||
it("a pin inside the late tail reads taken_late, never flattered", () => {
|
||||
const rows = reconstructDoseHistory(
|
||||
bands,
|
||||
|
||||
Reference in new issue
Block a user