summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/config.default.php4
-rw-r--r--includes/model/ShiftsFilter.php5
2 files changed, 9 insertions, 0 deletions
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;
}