mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 15:02:04 +00:00
feat(measurements): take hourly sums of summed types into the intraday profile and a backfill trigger that moves no live stamp; fix(backup): restore qualitative lab markers
This commit is contained in:
1 parent
79f7eb199b
commit
a0f6b89e92
34 files changed
+2468
-286
No files matched your search
@@ -455,6 +455,31 @@ describe("<AppleHealthCard> — per-type arrivals (#1173)", () => {
|
||||
expect(out).not.toContain("Last in background");
|
||||
});
|
||||
|
||||
// v1.43 (ios #77) — a history catch-up is named apart, and a type that
|
||||
// only ever arrived through one still reads as not received live.
|
||||
it("names the last backfill apart from the live arrival", () => {
|
||||
const live = html({
|
||||
...base,
|
||||
lastReceivedAt: hoursAgo(1),
|
||||
lastTrigger: "foreground",
|
||||
lastNewSampleAt: hoursAgo(1),
|
||||
lastBackfillAt: hoursAgo(3),
|
||||
});
|
||||
expect(live).toContain('data-state="received"');
|
||||
expect(live).toContain("History caught up 3 h ago");
|
||||
const backfillOnly = html({
|
||||
...base,
|
||||
lastReceivedAt: null,
|
||||
lastTrigger: null,
|
||||
lastNewSampleAt: null,
|
||||
lastBackfillAt: hoursAgo(2),
|
||||
});
|
||||
expect(backfillOnly).toContain('data-state="never"');
|
||||
expect(backfillOnly).toContain(
|
||||
"Not received yet, History caught up 2 h ago",
|
||||
);
|
||||
});
|
||||
|
||||
it("names the medication dose row in the freshness list", () => {
|
||||
statusPayload = {
|
||||
lastSyncedAt: hoursAgo(1),
|
||||
|
||||
@@ -148,16 +148,25 @@ export function ArrivalDetail({
|
||||
now?: Date;
|
||||
}) {
|
||||
if (entry.lastReceivedAt === undefined) return null;
|
||||
if (entry.lastReceivedAt === null) {
|
||||
return (
|
||||
<span data-testid="apple-health-arrival" data-state="never">
|
||||
{t("settings.appleHealth.freshness.never")}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
const reference = (now ?? new Date()).getTime();
|
||||
const relative = (iso: string) =>
|
||||
formatRelative(Math.max(0, reference - new Date(iso).getTime()), t);
|
||||
// v1.43 (ios #77) — a history catch-up is named apart from the live
|
||||
// arrivals, and never counts as one.
|
||||
const backfill = entry.lastBackfillAt
|
||||
? t("settings.appleHealth.freshness.lastBackfill", {
|
||||
relative: relative(entry.lastBackfillAt),
|
||||
})
|
||||
: null;
|
||||
if (entry.lastReceivedAt === null) {
|
||||
return (
|
||||
<span data-testid="apple-health-arrival" data-state="never">
|
||||
{[t("settings.appleHealth.freshness.never"), backfill]
|
||||
.filter((part): part is string => part !== null)
|
||||
.join(", ")}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
const trigger = entry.lastTrigger ?? null;
|
||||
const parts = [
|
||||
t("settings.appleHealth.freshness.lastReceived", {
|
||||
@@ -189,6 +198,7 @@ export function ArrivalDetail({
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (backfill) parts.push(backfill);
|
||||
return (
|
||||
<span
|
||||
data-testid="apple-health-arrival"
|
||||
|
||||
Reference in new issue
Block a user