Merge pull request 'changed logic in today and yesterday filter in hourly production' (#1346) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #1346
This commit was merged in pull request #1346.
This commit is contained in:
2026-10-29 06:08:00 +00:00

View File

@@ -159,10 +159,11 @@ class ItemOverview extends ChartWidget
->whereMonth('created_at', $startDate->month)
->sum('plan_quantity');
$weeksCount = (int) ceil($startDate->daysInMonth / 7);
$weeksCount = count($orderedData);
// Split the total monthly plan equally across all weeks
$weeklyPlan = $weeksCount > 0
? $monthlyPlanQuantity / $weeksCount
? round($monthlyPlanQuantity / $weeksCount, 2)
: 0;
$hourlyPlan = round($weeklyPlan / 22.5, 2);