From 874f982019df4a2053b9042c14a11fefd14a559f Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 15 Oct 2026 11:05:23 +0530 Subject: [PATCH] Changed logic in hourly count --- app/Filament/Widgets/ItemOverview.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Filament/Widgets/ItemOverview.php b/app/Filament/Widgets/ItemOverview.php index 25b7c3a7..57ab093c 100644 --- a/app/Filament/Widgets/ItemOverview.php +++ b/app/Filament/Widgets/ItemOverview.php @@ -140,10 +140,9 @@ class ItemOverview extends ChartWidget }, $shiftedKeys); } - $planData = array_map( - fn ($quantity) => round($quantity / 22.5, 2), - $orderedData - ); + $totalQuantity = array_sum($orderedData); + + $planQuantity = round($totalQuantity / 22.5, 2); return [ 'datasets' => [ @@ -172,7 +171,7 @@ class ItemOverview extends ChartWidget 'yesterday' => $isFgLine ? "Yesterday's FG Count" : "Yesterday's Hourly Production", default => $isFgLine ? "Today's FG Count" : "Today's Hourly Production", }, - 'data' => $planData, + 'data' => $planQuantity, 'borderColor' => 'rgba(255, 99, 132, 1)', 'backgroundColor' => 'rgba(75, 192, 192, 0.2)', 'fill' => false,