From 96d4968e1d9427b646f970a8184495b73ff5d856 Mon Sep 17 00:00:00 2001 From: msquare Date: Tue, 26 Dec 2017 17:35:34 +0100 Subject: [PATCH] fix dashboard stats --- includes/model/Stats.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/model/Stats.php b/includes/model/Stats.php index 94bb70ce..20376ac6 100644 --- a/includes/model/Stats.php +++ b/includes/model/Stats.php @@ -78,12 +78,12 @@ function stats_angels_needed_three_hours() SELECT SUM(`count`) FROM `NeededAngelTypes` 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` ) - ( SELECT COUNT(*) FROM `ShiftEntry` 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 `freeloaded`=0 ) @@ -101,12 +101,12 @@ function stats_angels_needed_three_hours() SELECT SUM(`count`) FROM `NeededAngelTypes` 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` ) - ( SELECT COUNT(*) FROM `ShiftEntry` 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 `freeloaded`=0 ) @@ -147,12 +147,12 @@ function stats_angels_needed_for_nightshifts() SELECT SUM(`count`) FROM `NeededAngelTypes` 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` ) - ( SELECT COUNT(*) FROM `ShiftEntry` 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 `freeloaded`=0 ) @@ -170,12 +170,12 @@ function stats_angels_needed_for_nightshifts() SELECT SUM(`count`) FROM `NeededAngelTypes` 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` ) - ( SELECT COUNT(*) FROM `ShiftEntry` 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 `freeloaded`=0 )