mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 23:52:24 +00:00
fix(insights): keep deleted mood entries and readings out of status snapshots
Four per-metric status snapshots read mood context without the tombstone filter, and the blood-pressure snapshot read measurements the same way, so a deleted entry kept shaping the text written about it. The breathing screen and the HRV widget probe had the same gap. One reader now serves the shared mood context, and a guard derives the soft-deleting models from the schema and fails on any unfiltered read in the analysis, insight and model-input directories.
This commit is contained in:
1 parent
fea1d1e0b5
commit
67e2563c63
10 files changed
+254
-33
No files matched your search
@@ -245,7 +245,11 @@ export const GET = apiHandler(async () => {
|
||||
let hasSdnn = true;
|
||||
if (!recoveryEnabled) {
|
||||
const sdnnRow = await prisma.measurement.findFirst({
|
||||
where: { userId: user.id, type: "HEART_RATE_VARIABILITY" },
|
||||
where: {
|
||||
userId: user.id,
|
||||
type: "HEART_RATE_VARIABILITY",
|
||||
deletedAt: null,
|
||||
},
|
||||
select: { id: true },
|
||||
});
|
||||
hasSdnn = sdnnRow !== null;
|
||||
|
||||
@@ -48,6 +48,7 @@ export const GET = apiHandler(async () => {
|
||||
const rows = await prisma.measurement.findMany({
|
||||
where: {
|
||||
userId: user.id,
|
||||
deletedAt: null,
|
||||
type: { in: ["BREATHING_DISTURBANCES", "BREATHING_DISTURBANCE_EVENT"] },
|
||||
measuredAt: { gte: since },
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user