changed logic in houlry report in production
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 4m35s
Laravel Larastan / larastan (pull_request) Failing after 5m7s

This commit is contained in:
dhanabalan
2026-10-15 11:20:41 +05:30
parent 387f31223b
commit 0c4134bd59

View File

@@ -140,15 +140,32 @@ class ItemOverview extends ChartWidget
}, $shiftedKeys);
}
$totalQuantity = array_sum($orderedData);
// $totalQuantity = array_sum($orderedData);
$planQuantity = round($totalQuantity / 22.5, 2);
// $planQuantity = round($totalQuantity / 22.5, 2);
$planData = array_fill(
0,
count($orderedData),
$planQuantity
);
// $planData = array_fill(
// 0,
// count($orderedData),
// $planQuantity
// );
if (in_array($activeFilter, ['today', 'yesterday'])) {
$planQuantity = round(array_sum($orderedData) / 22.5, 2);
$planData = array_fill(
0,
count($orderedData),
$planQuantity
);
} else {
// This Week: each day's production / 22.5
// This Month: each week's production / 22.5
$planData = array_map(
fn ($quantity) => round($quantity / 22.5, 2),
$orderedData
);
}
return [
'datasets' => [