fix(withings): keep the sleep nights read around a failing one

One failing per-night stage read threw out of the loop, so the nights
already read and the summary vitals were never written. A failed read
now leaves the others to be written, books the leg failed afterwards
and marks the night to be read first next run. A night that answers
without a stage three times is no longer read on every run; a full sync
still reads it. The per-night record lives on the connection (migration
0421) and is reset on reconnect.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 16:25:26 +02:00
1 parent a04a8352f5
commit 6bdd6f1c58
7 files changed
+356 -32

No files matched your search

+3
View File
@@ -216,6 +216,9 @@ export const GET = apiHandler(async (request: NextRequest) => {
// A reconnect may come with another developer app (another plan), so
// what the old grant's plan refused is asked for again.
apiPlanState: Prisma.DbNull,
// A reconnect may be another account or device, so nights it gave
// up on are tried again.
sleepStageReads: Prisma.DbNull,
},
create: {
userId: user.id,