fix hitung ayam dan karung data yang ditampilkan melebihi estimasi panen
CI / lint-and-test (push) Canceled after 0s
CI / lint-and-test (push) Canceled after 0s
This commit is contained in:
1 parent
32a36cceff
commit
b6117ae7d5
8 files changed
+105
-49
No files matched your search
@@ -178,8 +178,10 @@ const ChickenCountingDashboard: React.FC<ChickenCountingDashboardProps> = ({
|
||||
const startDate = new Date(cycleData.startDate);
|
||||
today.setHours(0, 0, 0, 0);
|
||||
startDate.setHours(0, 0, 0, 0);
|
||||
const currentDayOfCycle = Math.floor(
|
||||
(today.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24)
|
||||
const lastCycleDay = Math.max(0, (cycleData.totalDays || 1) - 1);
|
||||
const currentDayOfCycle = Math.min(
|
||||
Math.floor((today.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24)),
|
||||
lastCycleDay
|
||||
);
|
||||
|
||||
const recordMap = new Map<number, MortalitySourceRecord>();
|
||||
@@ -213,7 +215,7 @@ const ChickenCountingDashboard: React.FC<ChickenCountingDashboardProps> = ({
|
||||
|
||||
return { chickenCounts, populations };
|
||||
},
|
||||
[cycleData.startDate]
|
||||
[cycleData.startDate, cycleData.totalDays]
|
||||
);
|
||||
|
||||
// Fetch all data: total + per-kandang
|
||||
|
||||
Reference in new issue
Block a user