Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 5a46dd6

Browse files
committed
Fix rendering errors when scheduling window is 24 hours.
Signed-off-by: Max Fierke <max@maxfierke.com>
1 parent c47981a commit 5a46dd6

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

src/OpenSkedge/AppBundle/Controller/AvailabilityScheduleController.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ public function viewAction(Request $request, $uid, $spid)
104104
$startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour());
105105
$endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1;
106106

107+
if ($endIndex === -1) { // Midnight end hour
108+
$endIndex = 95;
109+
}
110+
107111
$hoursAvailable = 0;
108112
for ($day = 0; $day < 7; $day++) {
109113
$timeRec = $entity->getDay($day);
@@ -223,6 +227,10 @@ public function newAction(Request $request, $spid)
223227
$startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour());
224228
$endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1;
225229

230+
if ($endIndex === -1) { // Midnight end hour
231+
$endIndex = 95;
232+
}
233+
226234
return $this->render('OpenSkedgeBundle:AvailabilitySchedule:new.html.twig', array(
227235
'avail' => $entity,
228236
'htime' => $dtUtils->timeStrToDateTime($appSettings->getStartHour()),
@@ -298,6 +306,10 @@ public function editAction(Request $request, $spid)
298306
$startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour());
299307
$endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1;
300308

309+
if ($endIndex === -1) { // Midnight end hour
310+
$endIndex = 95;
311+
}
312+
301313
$hoursAvailable = 0;
302314
for ($day = 0; $day < 7; $day++) {
303315
$timeRec = $entity->getDay($day);

src/OpenSkedge/AppBundle/Controller/DashboardController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public function indexAction(Request $request)
7474
$startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour());
7575
$endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1;
7676

77+
if ($endIndex === -1) { // Midnight end hour
78+
$endIndex = 95;
79+
}
80+
7781
return $this->render('OpenSkedgeBundle:Dashboard:index.html.twig', array(
7882
'htime' => $dtUtils->timeStrToDateTime($appSettings->getStartHour()),
7983
'resolution' => $resolution,

src/OpenSkedge/AppBundle/Controller/ScheduleController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public function viewAction(Request $request, $pid, $spid)
8181
$startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour());
8282
$endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1;
8383

84+
if ($endIndex === -1) { // Midnight end hour
85+
$endIndex = 95;
86+
}
87+
8488
return $this->render('OpenSkedgeBundle:Schedule:view.html.twig', array(
8589
'htime' => $dtUtils->timeStrToDateTime($appSettings->getStartHour()),
8690
'resolution' => $resolution,
@@ -271,6 +275,10 @@ public function editAction(Request $request, $pid, $spid)
271275
$startIndex = $dtUtils->getIndexFromTime($appSettings->getStartHour());
272276
$endIndex = $dtUtils->getIndexFromTime($appSettings->getEndHour())-1;
273277

278+
if ($endIndex === -1) { // Midnight end hour
279+
$endIndex = 95;
280+
}
281+
274282
return $this->render('OpenSkedgeBundle:Schedule:edit.html.twig', array(
275283
'htime' => $dtUtils->timeStrToDateTime($appSettings->getStartHour()),
276284
'resolution' => $resolution,

src/OpenSkedge/AppBundle/Services/StatsService.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ public function weekClockReport($uid, $week)
7070
foreach ($shifts as $shift) {
7171
$startIndex = $this->dtUtils->getIndexFromTime($shift->getStartTime());
7272
$endIndex = $this->dtUtils->getIndexFromTime($shift->getEndTime());
73+
74+
if ($endIndex === -1) { // Midnight end hour
75+
$endIndex = 96;
76+
}
7377
// Update the schedule composite to mark shifts they had picked up.
7478
if ($shift->getStartTime()->format('w') === $shift->getEndTime()->format('w')) {
7579
$day = $shift->getStartTime()->format('w');

0 commit comments

Comments
 (0)