diff --git a/src/lib/analytics/bp-in-target-fast-path.ts b/src/lib/analytics/bp-in-target-fast-path.ts index 1beddab44..a254a262a 100644 --- a/src/lib/analytics/bp-in-target-fast-path.ts +++ b/src/lib/analytics/bp-in-target-fast-path.ts @@ -432,7 +432,7 @@ async function fetchSeriesChunked( let cursorId: string | undefined; for (let page = 0; page < 1000; page++) { const chunk = await prisma.measurement.findMany({ - where: { userId, type, measuredAt: { gte: since } }, + where: { userId, type, measuredAt: { gte: since }, deletedAt: null }, orderBy: [{ measuredAt: "asc" }, { id: "asc" }], select: { id: true, measuredAt: true, value: true }, take: CHUNK, diff --git a/src/lib/analytics/correlations-fast-path.ts b/src/lib/analytics/correlations-fast-path.ts index d5fe75223..ba82bb7b3 100644 --- a/src/lib/analytics/correlations-fast-path.ts +++ b/src/lib/analytics/correlations-fast-path.ts @@ -342,7 +342,7 @@ async function fetchSeriesChunked( let cursorId: string | undefined; for (let page = 0; page < 1000; page++) { const chunk = await prisma.measurement.findMany({ - where: { userId, type, measuredAt: { gte: since } }, + where: { userId, type, measuredAt: { gte: since }, deletedAt: null }, orderBy: [{ measuredAt: "asc" }, { id: "asc" }], select: { id: true, measuredAt: true, value: true }, take: CHUNK, diff --git a/src/lib/analytics/health-score-fast-path.ts b/src/lib/analytics/health-score-fast-path.ts index 3350bbdf0..1257172cb 100644 --- a/src/lib/analytics/health-score-fast-path.ts +++ b/src/lib/analytics/health-score-fast-path.ts @@ -192,6 +192,7 @@ export async function computeUserHealthScoreFastPath( userId, type: "WEIGHT", measuredAt: { gte: since30d, lte: now }, + deletedAt: null, }, select: { measuredAt: true, source: true }, orderBy: { measuredAt: "asc" }, @@ -206,6 +207,7 @@ export async function computeUserHealthScoreFastPath( userId, type: "WEIGHT", measuredAt: { gte: prevSince30d, lte: now }, + deletedAt: null, }, select: { value: true, measuredAt: true, source: true }, orderBy: { measuredAt: "asc" }, @@ -235,6 +237,7 @@ export async function computeUserHealthScoreFastPath( userId, type: "BLOOD_PRESSURE_SYS", measuredAt: { gte: since30d, lte: now }, + deletedAt: null, }, select: { measuredAt: true, source: true }, orderBy: { measuredAt: "asc" },