From 537179df66b1245f034e9bedeff7d74cbc6a7f5c Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Fri, 27 Dec 2019 18:58:27 +0100 Subject: Shifts overview: Added filter_max_duration to limit max runtime --- config/config.default.php | 4 ++++ includes/model/ShiftsFilter.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/config/config.default.php b/config/config.default.php index 1454017b..2a988788 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -167,6 +167,10 @@ return [ '4XL' => '4XLarge Straight-Cut', ], + // Shifts overview + // Set max number of hours that can be shown at once + 'filter_max_duration' => 0, + // Session config 'session' => [ // Supported: pdo or native diff --git a/includes/model/ShiftsFilter.php b/includes/model/ShiftsFilter.php index fe3bfa56..c3811977 100644 --- a/includes/model/ShiftsFilter.php +++ b/includes/model/ShiftsFilter.php @@ -119,6 +119,11 @@ class ShiftsFilter */ public function setEndTime($endTime) { + $filterMaxDuration = config('filter_max_duration') * 60 * 60; + if ($filterMaxDuration && ($endTime - $this->startTime > $filterMaxDuration)) { + $endTime = $this->startTime + $filterMaxDuration; + } + $this->endTime = $endTime; } -- cgit v1.2.3