fix day 1 target weight bug and chicken counting row not showed before publish cutoff
This commit is contained in:
1 parent
05465b0382
commit
3fe6b05258
5 files changed
+28
-11
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import type { ChickenCounting, Cycle, KPI, ManualInput } from '../types/api.ts';
|
||||
import { addDaysIso, cycleDayForDate, cycleLastDayIndex } from './format.ts';
|
||||
import { addDaysIso, cycleDayForDate, todayIso } from './format.ts';
|
||||
import { stockAkhirFromKpi } from './kpiStock.ts';
|
||||
|
||||
export const COUNTING_ACCURACY_WARNING_THRESHOLD = 95;
|
||||
@@ -39,8 +39,9 @@ function stockAkhirByDate(
|
||||
const manualByDate = new Map(manualInputs.map((m) => [m.date, m]));
|
||||
|
||||
const lastCycleDay = Math.max(0, (cycle.total_days || 1) - 1);
|
||||
const endDay = cycleLastDayIndex(cycle);
|
||||
const maxDay = Math.min(lastCycleDay, endDay);
|
||||
const calendarDay = cycleDayForDate(cycle.start_date, todayIso());
|
||||
const endDay = cycle.end_date ? cycleDayForDate(cycle.start_date, cycle.end_date) : calendarDay;
|
||||
const maxDay = Math.min(calendarDay, lastCycleDay, endDay);
|
||||
|
||||
const result = new Map<string, number>();
|
||||
let previousStockAkhir = 0;
|
||||
|
||||
Reference in new issue
Block a user