diff options
author | msquare <msquare@notrademark.de> | 2017-07-28 19:28:11 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2017-07-28 19:28:11 +0200 |
commit | 4effb7e59f1bba13230060481eb126548b5442ca (patch) | |
tree | f4a88e7714584218e9e94295cf0be3b40c45ffbe /includes | |
parent | 440ed74cd7a0bde035a93fde36b08b9a5aca557d (diff) |
fix lane rendering
Diffstat (limited to 'includes')
-rw-r--r-- | includes/view/ShiftCalendarLane.php | 3 | ||||
-rw-r--r-- | includes/view/ShiftCalendarRenderer.php | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/includes/view/ShiftCalendarLane.php b/includes/view/ShiftCalendarLane.php index 251b8013..fd4c6f06 100644 --- a/includes/view/ShiftCalendarLane.php +++ b/includes/view/ShiftCalendarLane.php @@ -2,6 +2,8 @@ namespace Engelsystem; +use Exception; + /** * Represents a single lane in a shifts calendar. */ @@ -38,6 +40,7 @@ class ShiftCalendarLane * Returns true on success. * * @param array $shift The shift to add + * @throws Exception if the shift doesn't fit into the lane. */ public function addShift($shift) { diff --git a/includes/view/ShiftCalendarRenderer.php b/includes/view/ShiftCalendarRenderer.php index df24ad3b..3269f338 100644 --- a/includes/view/ShiftCalendarRenderer.php +++ b/includes/view/ShiftCalendarRenderer.php @@ -1,6 +1,8 @@ <?php namespace Engelsystem; +use Exception; + class ShiftCalendarRenderer { @@ -93,9 +95,9 @@ class ShiftCalendarRenderer $shift_added = false; foreach ($lanes[$room_id] as $lane) { /** @var ShiftCalendarLane $lane */ - try { + if($lane->shiftFits($shift)) { $lane->addShift($shift); - } catch (Exception $e) { + $shift_added = true; break; } } |