diff options
| author | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2022-08-09 13:04:35 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2022-08-09 13:04:35 +0000 |
| commit | 4ab2aba9254a77ee0ae203bb1516808ef7e0c5f6 (patch) | |
| tree | e3480a1853c6d3bfb8b7d3bc45cbb53d9bfff7f1 /lib/models/resources/GlobalResourceLock.class.php | |
| parent | b997da7589eba93245e600131dcd4bd40cb2ce44 (diff) | |
switch resource locking to check the booking interval, fixes #1350 and #185
Closes #1350 and #185
Merge request studip/studip!834
Diffstat (limited to 'lib/models/resources/GlobalResourceLock.class.php')
| -rw-r--r-- | lib/models/resources/GlobalResourceLock.class.php | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/models/resources/GlobalResourceLock.class.php b/lib/models/resources/GlobalResourceLock.class.php index 4b0e009..541cc0f 100644 --- a/lib/models/resources/GlobalResourceLock.class.php +++ b/lib/models/resources/GlobalResourceLock.class.php @@ -53,17 +53,11 @@ class GlobalResourceLock extends SimpleORMap parent::configure($config); } - public static function currentlyLocked() + public static function isLocked($begin, $end) { - $now = time(); - return self::countBySql( - 'begin <= :now AND end >= :now', - [ - 'now' => $now - ] - ) > 0; + return self::countBySql('begin < :end AND end > :begin', compact('begin', 'end')) > 0; } - + /** * Returns a list of defined lock types. * |
