fix weight ai insight target weight data using mr. mike instead of cp707

This commit is contained in:
Alberto-Audrix committed 2026-10-01 16:59:58 +07:00
1 parent bc2b260065
commit 05465b0382
5 files changed
+83 -11

No files matched your search

+3 -2
View File
@@ -209,6 +209,7 @@ export type BuildWeightInsightContextArgs = {
cycleId?: number;
hari_ke?: number | null;
totalDays?: number | null;
docWeight?: number | null;
weightRows?: WeightInsightRow[];
averageWeight?: number | null;
targetWeight?: number | null;
@@ -226,8 +227,8 @@ export function buildWeightInsightContext(args: BuildWeightInsightContextArgs):
const hari = dayOf(row);
if (hari === null) return null;
const bobot = num(row.average_weight) ?? num(row.bobot_gram);
const target =
num(row.target_gram) ?? (totalDays != null ? getTargetWeightForAge(hari, totalDays) : null);
const doc = num(row.doc_weight) ?? num(args.docWeight) ?? 40;
const target = num(row.target_gram) ?? (hari > 0 ? getTargetWeightForAge(hari, doc) : null);
return {
hari,
bobot_gram: bobot != null && bobot > 0 ? bobot : null,