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

+3 -1
View File
@@ -1,5 +1,6 @@
import type { ChickenCounting, Cycle, KPI, ManualInput } from '../types/api.ts';
import { addDaysIso, cycleDayForDate, cycleLastDayIndex } from './format.ts';
import { stockAkhirFromKpi } from './kpiStock.ts';
export const COUNTING_ACCURACY_WARNING_THRESHOLD = 95;
@@ -51,7 +52,8 @@ function stockAkhirByDate(
const stockAwal = day === 0 ? cycle.doc_in_count || 0 : previousStockAkhir;
const mati = manual?.mortality_manual ?? kpi?.mortality ?? 0;
const panen = manual?.harvest_manual ?? kpi?.harvest ?? 0;
const stockAkhir = kpi?.chicken_life ?? Math.max(0, stockAwal - mati - panen);
const stockAkhir =
stockAkhirFromKpi(kpi) ?? Math.max(0, stockAwal - mati - panen);
result.set(date, stockAkhir);
previousStockAkhir = stockAkhir;
}