Shifts overview: Added filter_max_duration to limit max runtime

This commit is contained in:
Igor Scheller 2019-12-27 18:58:27 +01:00
parent 8f2da56892
commit 537179df66
2 changed files with 9 additions and 0 deletions

View File

@ -167,6 +167,10 @@ return [
'4XL' => '4XLarge Straight-Cut', '4XL' => '4XLarge Straight-Cut',
], ],
// Shifts overview
// Set max number of hours that can be shown at once
'filter_max_duration' => 0,
// Session config // Session config
'session' => [ 'session' => [
// Supported: pdo or native // Supported: pdo or native

View File

@ -119,6 +119,11 @@ class ShiftsFilter
*/ */
public function setEndTime($endTime) public function setEndTime($endTime)
{ {
$filterMaxDuration = config('filter_max_duration') * 60 * 60;
if ($filterMaxDuration && ($endTime - $this->startTime > $filterMaxDuration)) {
$endTime = $this->startTime + $filterMaxDuration;
}
$this->endTime = $endTime; $this->endTime = $endTime;
} }