update karung related component to follow cutoff time

This commit is contained in:
Alberto-Audrix committed 2026-10-09 08:46:13 +07:00
1 parent 26c69b340d
commit 03c7dcb646
5 files changed
+84 -53

No files matched your search

+8 -4
View File
@@ -30,6 +30,7 @@ const StatItem: React.FC<{
interface FeedStatsProps {
latest: Karung | null;
latestManual: ManualInput | null;
lastRecordedManual?: ManualInput | null;
cycleStartDate: string;
displayDate: string;
}
@@ -37,6 +38,7 @@ interface FeedStatsProps {
const FeedStats: React.FC<FeedStatsProps> = ({
latest,
latestManual,
lastRecordedManual,
cycleStartDate,
displayDate,
}) => {
@@ -61,6 +63,8 @@ const FeedStats: React.FC<FeedStatsProps> = ({
return `Total (${start} - ${end})`;
}, [cycleStartDate, displayDate]);
const cumulativeManual = lastRecordedManual ?? latestManual;
const columns = useMemo(
() => [
{
@@ -71,7 +75,7 @@ const FeedStats: React.FC<FeedStatsProps> = ({
iotToday: latest?.in_today ?? 0,
iotTotal: latest?.in_total ?? 0,
manualToday: latestManual?.feed_in_manual ?? 0,
manualTotal: latestManual?.feed_in_manual_total ?? 0,
manualTotal: cumulativeManual?.feed_in_manual_total ?? 0,
},
{
key: 'dituang',
@@ -81,7 +85,7 @@ const FeedStats: React.FC<FeedStatsProps> = ({
iotToday: latest?.feed_use_today ?? 0,
iotTotal: latest?.feed_use_total ?? 0,
manualToday: latestManual?.feed_use_manual ?? 0,
manualTotal: latestManual?.feed_use_manual_total ?? 0,
manualTotal: cumulativeManual?.feed_use_manual_total ?? 0,
},
{
key: 'keluar',
@@ -91,10 +95,10 @@ const FeedStats: React.FC<FeedStatsProps> = ({
iotToday: latest?.out_today ?? 0,
iotTotal: latest?.out_total ?? 0,
manualToday: latestManual?.feed_out_manual ?? 0,
manualTotal: latestManual?.feed_out_manual_total ?? 0,
manualTotal: cumulativeManual?.feed_out_manual_total ?? 0,
},
],
[latest, latestManual]
[latest, latestManual, cumulativeManual]
);
return (