changed logic in production dashboard
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 3m14s
Laravel Larastan / larastan (pull_request) Failing after 6m0s

This commit is contained in:
dhanabalan
2026-10-29 09:39:57 +05:30
parent 4cea958297
commit a1457a1e76

View File

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