Merge pull request 'changed logic in production dashboard' (#1333) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s

Reviewed-on: #1333
This commit was merged in pull request #1333.
This commit is contained in:
2026-10-29 04:10:14 +00:00

View File

@@ -160,20 +160,20 @@ class ItemOverview extends ChartWidget
); );
} }
elseif ($activeFilter === 'this_month') { elseif ($activeFilter === 'this_month') {
$weeklyProduction = [];
foreach ($orderedData as $index => $quantity) { $monthlyPlan = round(array_sum($orderedData) / 22.5, 2);
$day = (int) date('j', strtotime($labels[$index]));
$weekNumber = (int) ceil($day / 7);
$weeklyProduction[$weekNumber] = $weeksCount = count($orderedData);
($weeklyProduction[$weekNumber] ?? 0) + $quantity;
}
$planData = [];
foreach ($weeklyProduction as $weekNumber => $quantity) { $weeklyPlan = $weeksCount > 0
$planData[] = round($quantity / 22.5, 2); ? round($monthlyPlan / $weeksCount, 2)
} : 0;
$planData = array_fill(
0,
$weeksCount,
$weeklyPlan
);
} }
else { else {