fix dashboard stats

main
msquare 7 years ago
parent bf7474b3d3
commit 96d4968e1d

@ -78,12 +78,12 @@ function stats_angels_needed_three_hours()
SELECT SUM(`count`) SELECT SUM(`count`)
FROM `NeededAngelTypes` FROM `NeededAngelTypes`
JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id` JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
WHERE `AngelTypes`.`show_on_dashboard`=FALSE WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `NeededAngelTypes`.`shift_id`=`Shifts`.`SID` AND `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
) - ( ) - (
SELECT COUNT(*) FROM `ShiftEntry` SELECT COUNT(*) FROM `ShiftEntry`
JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID` JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
WHERE `AngelTypes`.`show_on_dashboard`=FALSE WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `ShiftEntry`.`SID`=`Shifts`.`SID` AND `ShiftEntry`.`SID`=`Shifts`.`SID`
AND `freeloaded`=0 AND `freeloaded`=0
) )
@ -101,12 +101,12 @@ function stats_angels_needed_three_hours()
SELECT SUM(`count`) SELECT SUM(`count`)
FROM `NeededAngelTypes` FROM `NeededAngelTypes`
JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id` JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
WHERE `AngelTypes`.`show_on_dashboard`=FALSE WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `NeededAngelTypes`.`room_id`=`Shifts`.`RID` AND `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
) - ( ) - (
SELECT COUNT(*) FROM `ShiftEntry` SELECT COUNT(*) FROM `ShiftEntry`
JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID` JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
WHERE `AngelTypes`.`show_on_dashboard`=FALSE WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `ShiftEntry`.`SID`=`Shifts`.`SID` AND `ShiftEntry`.`SID`=`Shifts`.`SID`
AND `freeloaded`=0 AND `freeloaded`=0
) )
@ -147,12 +147,12 @@ function stats_angels_needed_for_nightshifts()
SELECT SUM(`count`) SELECT SUM(`count`)
FROM `NeededAngelTypes` FROM `NeededAngelTypes`
JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id` JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
WHERE `AngelTypes`.`show_on_dashboard`=FALSE WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `NeededAngelTypes`.`shift_id`=`Shifts`.`SID` AND `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
) - ( ) - (
SELECT COUNT(*) FROM `ShiftEntry` SELECT COUNT(*) FROM `ShiftEntry`
JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID` JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
WHERE `AngelTypes`.`show_on_dashboard`=FALSE WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `ShiftEntry`.`SID`=`Shifts`.`SID` AND `ShiftEntry`.`SID`=`Shifts`.`SID`
AND `freeloaded`=0 AND `freeloaded`=0
) )
@ -170,12 +170,12 @@ function stats_angels_needed_for_nightshifts()
SELECT SUM(`count`) SELECT SUM(`count`)
FROM `NeededAngelTypes` FROM `NeededAngelTypes`
JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id` JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
WHERE `AngelTypes`.`show_on_dashboard`=FALSE WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `NeededAngelTypes`.`room_id`=`Shifts`.`RID` AND `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
) - ( ) - (
SELECT COUNT(*) FROM `ShiftEntry` SELECT COUNT(*) FROM `ShiftEntry`
JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID` JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
WHERE `AngelTypes`.`show_on_dashboard`=FALSE WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `ShiftEntry`.`SID`=`Shifts`.`SID` AND `ShiftEntry`.`SID`=`Shifts`.`SID`
AND `freeloaded`=0 AND `freeloaded`=0
) )

Loading…
Cancel
Save