fix lane rendering

main
msquare 7 years ago
parent 440ed74cd7
commit 4effb7e59f

@ -2,6 +2,8 @@
namespace Engelsystem; namespace Engelsystem;
use Exception;
/** /**
* Represents a single lane in a shifts calendar. * Represents a single lane in a shifts calendar.
*/ */
@ -38,6 +40,7 @@ class ShiftCalendarLane
* Returns true on success. * Returns true on success.
* *
* @param array $shift The shift to add * @param array $shift The shift to add
* @throws Exception if the shift doesn't fit into the lane.
*/ */
public function addShift($shift) public function addShift($shift)
{ {

@ -1,6 +1,8 @@
<?php <?php
namespace Engelsystem; namespace Engelsystem;
use Exception;
class ShiftCalendarRenderer class ShiftCalendarRenderer
{ {
@ -93,9 +95,9 @@ class ShiftCalendarRenderer
$shift_added = false; $shift_added = false;
foreach ($lanes[$room_id] as $lane) { foreach ($lanes[$room_id] as $lane) {
/** @var ShiftCalendarLane $lane */ /** @var ShiftCalendarLane $lane */
try { if($lane->shiftFits($shift)) {
$lane->addShift($shift); $lane->addShift($shift);
} catch (Exception $e) { $shift_added = true;
break; break;
} }
} }

Loading…
Cancel
Save