fix lane rendering

This commit is contained in:
msquare 2017-07-28 19:28:11 +02:00
parent 440ed74cd7
commit 4effb7e59f
2 changed files with 7 additions and 2 deletions

View File

@ -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)
{

View File

@ -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;
}
}