summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-12-14 19:39:47 +0100
committermsquare <msquare@notrademark.de>2017-12-14 19:39:52 +0100
commit20f4d44cbf159f25f78312290be52fcfafef02de (patch)
treeda8b37848b8ecb0f3fb493d92a2a5b0b1f5ba922 /includes/model/Shifts_model.php
parent35be25a78642039aba49ad5d6e80ad8ca89a2b1f (diff)
fix union queries for dashboard stats
Diffstat (limited to 'includes/model/Shifts_model.php')
-rw-r--r--includes/model/Shifts_model.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 2a77fd35..8cbbe2aa 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -38,6 +38,7 @@ function Shifts_free($start, $end)
WHERE (`end` > ? AND `start` < ?)
AND (SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
> (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
+ AND `Shifts`.`PSID` IS NULL
UNION
@@ -46,6 +47,7 @@ function Shifts_free($start, $end)
WHERE (`end` > ? AND `start` < ?)
AND (SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
> (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
+ AND NOT `Shifts`.`PSID` IS NULL
) as `tmp`
ORDER BY `tmp`.`start`
", [