1
0
forked from poc/pds

Added hourly chart logic for production in modules

This commit is contained in:
dhanabalan
2025-07-11 17:26:46 +05:30
parent b4ca4a9fcd
commit 4d5b14fe69

View File

@@ -233,11 +233,15 @@ class ModuleFilterDataController extends Controller
// ], 200);
$chartName = $request->header('chart-name');
if ($chartName == 'Production Hourly Count') {
if ($chartName == 'Production Hourly Count')
{
$hourlyCounts = [];
$hourStart = $startDate->copy();
while ($hourStart < $endDate) {
// Force start at 8:00 AM today
$hourStart = now()->startOfDay()->addHours(8); // today 08:00 AM
$hourEndFinal = $hourStart->copy()->addDay(); // next day 08:00 AM
while ($hourStart < $hourEndFinal) {
$hourEnd = $hourStart->copy()->addHour();
$label = $hourStart->format('g:i A') . ' to ' . $hourEnd->format('g:i A');