mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
fix(labs): stop projecting lab trends from stale or short series
A marker whose newest reading is more than a year old is now reported as of that reading (projection "stale"), with no exit date and no already-outside verdict. The projection horizon is capped at the span the readings cover, so a line is never carried further ahead than the data reaches back. The detail read keeps the newest 2000 readings rather than the oldest.
This commit is contained in:
1 parent
5f563623d7
commit
e482f76508
16 files changed
+165
-30
No files matched your search
@@ -74,7 +74,9 @@ export const GET = apiHandler(
|
||||
deletedAt: null,
|
||||
value: { not: null },
|
||||
},
|
||||
orderBy: { takenAt: "asc" },
|
||||
// Newest first, so a capped read keeps the recent end of the series
|
||||
// (the staleness check reads the newest reading); the fit sorts.
|
||||
orderBy: { takenAt: "desc" },
|
||||
take: LAB_TREND_READ_CAP,
|
||||
select: { takenAt: true, value: true },
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user