mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 16:12:11 +00:00
fix(apple-health): count readings entered here before calling a type quiet (#1247)
Weight, blood pressure and blood glucose are written back to the phone while their entry is bidirectional. A reading entered here goes to Apple Health and never arrives back, so a person who keeps those readings here saw the type go quiet after two weeks. The Apple Health status read now adds `lastEnteredHereAt` to each written-back type, the newest reading from any source other than Apple Health, and `stale` counts it; the card shows it as "Last entered here". The value is resolved on the server so a client renders it as sent.
This commit is contained in:
1 parent
2b61762962
commit
0497685db0
16 files changed
+271
-21
No files matched your search
@@ -531,6 +531,33 @@ describe("<AppleHealthCard> — per-type arrivals (#1173)", () => {
|
||||
expect(out).toContain("Not received yet");
|
||||
});
|
||||
|
||||
// #1247 — weight entered here goes to the phone and never arrives back.
|
||||
it("names when a written-back type was last entered here", () => {
|
||||
const received = html({
|
||||
...base,
|
||||
type: "WEIGHT",
|
||||
lastReceivedAt: hoursAgo(400),
|
||||
lastTrigger: "background",
|
||||
lastNewSampleAt: hoursAgo(400),
|
||||
lastEnteredHereAt: hoursAgo(48),
|
||||
});
|
||||
expect(received).toContain("Last entered here 2 d ago");
|
||||
const never = html({
|
||||
...base,
|
||||
type: "WEIGHT",
|
||||
lastReceivedAt: null,
|
||||
lastEnteredHereAt: hoursAgo(48),
|
||||
});
|
||||
expect(never).toContain("Not received yet");
|
||||
expect(never).toContain("Last entered here 2 d ago");
|
||||
const noLedger = html({
|
||||
...base,
|
||||
type: "WEIGHT",
|
||||
lastEnteredHereAt: hoursAgo(48),
|
||||
});
|
||||
expect(noLedger).toContain('data-state="entered-here"');
|
||||
});
|
||||
|
||||
it("renders nothing when the server sent no arrival facts", () => {
|
||||
expect(html(base)).toBe("");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user