diff --git a/api/app/Http/Controllers/ProgramController.php b/api/app/Http/Controllers/ProgramController.php index 5842341..00e6377 100644 --- a/api/app/Http/Controllers/ProgramController.php +++ b/api/app/Http/Controllers/ProgramController.php @@ -89,7 +89,7 @@ QUERY; if($item->startdate) print "-- (Item start is {$item->startdate->format('Y-m-d H:i')}, end is ". ($item->enddate ? $item->enddate->format('Y-m-d H:i') : "never") . ")
\n"; } - if($item->startdate && $itemStart <= $item->startdate) { + if($item->startdate && $itemStart < $item->startdate) { if($DEBUG) print "-- Skipping {$item->name} {$item->suffix} (#$item->scheduleid) at {$itemStart->format('Y-m-d H:i')} because it is before the schedule instance start.
\n"; } else if($item->enddate && $itemStart >= $item->enddate) { if($DEBUG) print "-- Skipping {$item->name} {$item->suffix} (#$item->scheduleid) at {$itemStart->format('Y-m-d H:i')} because it is after the schedule instance end.
\n"; @@ -112,7 +112,7 @@ QUERY; if($DEBUG) { print "

Schedule changes


"; } @@ -132,8 +132,12 @@ QUERY; $priority = $item[2]->priority; if($item[0] == $START) { if($active[$priority] != null) { - print( "Error:" . $item[2]->name . ' starts at ' . $item[1]->format('d-m-Y H:i') . ' but ' . $active[$priority]->name . ' is still active then.' ); - print "
"; var_dump($active); print "
"; + print( "Error:" . $item[2]->name . ' starts at ' . $item[1]->format('d-m-Y H:i') . ' (prio ' . $item[2]->id . ') but ' . $active[$priority]->name . ' is still active then.' ); + if($DEBUG) { + foreach($active as $prio => $act) { + print "-- " . ($act ? $act->name : "[No program]") . " at prio $prio
\n"; + } + } } // When a program starts, it becomes the active program in its layer @@ -152,7 +156,11 @@ QUERY; } else if($item[0] == $END) { if($active[$priority] == null) { print( "Error:" . $item[2]->name . ' ends at ' . $item[1]->format('d-m-Y H:i') . ' but no program is active at that priority and timestamp.'); - print "
"; var_dump($active); print "
"; + if($DEBUG) { + foreach($active as $prio => $act) { + print "-- " . ($act ? $act->name : "[No program]") . " at prio $prio
\n"; + } + } } // When the program ends, its layer becomes inactive.