fix day 1 target weight bug and chicken counting row not showed before publish cutoff

This commit is contained in:
Alberto-Audrix committed 2026-10-02 10:47:00 +07:00
1 parent 05465b0382
commit 3fe6b05258
5 files changed
+28 -11

No files matched your search

+4 -2
View File
@@ -6,7 +6,6 @@ import { Banner, EmptyFarm, PageHeader, Spinner } from '../ui/Feedback.tsx';
import {
addDaysIso,
cycleDayForDate,
cycleLastDayIndex,
formatDateId,
formatDateRange,
formatNumber,
@@ -116,8 +115,11 @@ const DataManagementPage: React.FC<{ onSettings: () => void }> = ({ onSettings }
const kpiByDate = new Map(kpis.map((k) => [k.date, k]));
const lastCycleDay = Math.max(0, (selectedCycle.total_days || 1) - 1);
const endDay = cycleLastDayIndex(selectedCycle);
const calendarDay = cycleDayForDate(selectedCycle.start_date, todayIso());
// Closed cycles stop at end_date; active / open cycles build daily rows through calendar today.
const endDay = selectedCycle.end_date
? cycleDayForDate(selectedCycle.start_date, selectedCycle.end_date)
: calendarDay;
const maxDay = Math.min(calendarDay, lastCycleDay, endDay);
const today = todayIso();