adjust ai insight and seed data

This commit is contained in:
Alberto-Audrix committed 2026-09-18 11:34:07 +07:00
1 parent 68e0d1a0bb
commit a2b5b10977
18 files changed
+1835 -140

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
/**
* KPI.chicken_life = DOC − cumulative mortality (excludes harvest).
* Stock akhir (in-house remaining) = chicken_life − harvest_total.
*/
export function stockAkhirFromKpi(
kpi: { chicken_life?: number | null; harvest_total?: number | null } | null | undefined
): number | null {
if (kpi?.chicken_life == null) return null;
return Math.max(0, kpi.chicken_life - (kpi.harvest_total ?? 0));
}