summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2019-12-27 18:58:27 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2019-12-27 18:58:27 +0100
commit537179df66b1245f034e9bedeff7d74cbc6a7f5c (patch)
tree1093d44c103f461ecbfd197808b7449b949ecf35
parent8f2da568929232fd6cf206909c05ebefc1b24737 (diff)
Shifts overview: Added filter_max_duration to limit max runtime
-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;
}