fix(apple-health): show a written-back type's newest reading on its row

A reading entered here goes to Apple Health as well, and the quiet
verdict already counted it, but the row still showed the newest reading
that arrived from the phone, so a type entered two minutes ago read one
day old. The server now resolves lastSeenAt to the newer of the two for
the types the app writes back, and the row and the verdict agree.

Refs #1247
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 19:47:07 +02:00
1 parent a0e725556b
commit 628f37bc62
4 files changed
+19 -8

No files matched your search

@@ -406,6 +406,9 @@ describe("GET /api/integrations/healthkit — sync health", () => {
expect(entries.WEIGHT.lastEnteredHereAt).toBe(
enteredHereAt.toISOString(),
);
// The reading entered here is in Apple Health too, so it is the type's
// newest reading: the row and the verdict read the same instant.
expect(entries.WEIGHT.lastSeenAt).toBe(enteredHereAt.toISOString());
// A read-only type keeps its own verdict and carries no such field.
expect(entries.PULSE.stale).toBe(true);
expect(entries.PULSE).not.toHaveProperty("lastEnteredHereAt");