From 65a665ee4919e6783fb9475f3acf652c0ff45b81 Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 28 Dec 2016 00:11:42 +0100 Subject: [PATCH] reduce max shift filter duration to 24h --- includes/model/ShiftsFilter.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/includes/model/ShiftsFilter.php b/includes/model/ShiftsFilter.php index 044b32dd..ff1f5d40 100644 --- a/includes/model/ShiftsFilter.php +++ b/includes/model/ShiftsFilter.php @@ -9,6 +9,12 @@ namespace Engelsystem; */ class ShiftsFilter { + /** + * How long can the time interval be? + */ + const MAX_DURATION = 86400; + // one day + /** * Shift is completely full. */ @@ -63,6 +69,9 @@ class ShiftsFilter { } public function setEndTime($endTime) { + if ($endTime - $this->startTime > ShiftsFilter::MAX_DURATION) { + $endTime = $this->startTime + ShiftsFilter::MAX_DURATION; + } $this->endTime = $endTime; }