From cbeb45ef16a62095a44f14dc7a2ff7a20b947c74 Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 28 Dec 2016 14:34:09 +0100 Subject: [PATCH] redo --- includes/model/Shifts_model.php | 41 --------------------------------- 1 file changed, 41 deletions(-) diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 87edba8d..e7a93345 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -69,9 +69,7 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter) { return $result; } -/* function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter) { - $time_start = microtime(true); $SQL = "SELECT `NeededAngelTypes`.*, `Shifts`.`SID`, `AngelTypes`.`id`, `AngelTypes`.`name`, `AngelTypes`.`restricted`, `AngelTypes`.`no_self_signup` FROM `Shifts` JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID` @@ -93,45 +91,6 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter) { if ($result === false) { engelsystem_error("Unable to load needed angeltypes by filter."); } - echo microtime(true)-$time_start;die(); - return $result; -} -*/ -function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter) { -// $time_start = microtime(true); - $SQL = "CREATE TEMPORARY TABLE - shifts_view - AS - SELECT `Shifts`.`SID`, `Shifts`.`PSID`, `Shifts`.`RID` - FROM `Shifts` - WHERE `Shifts`.`RID` IN (" . implode(',', $shiftsFilter->getRooms()) . ") - AND `start` BETWEEN " . $shiftsFilter->getStartTime() . " AND " . $shiftsFilter->getEndTime() . " - ;"; - $result = sql_query($SQL); - if ($result === false) { - engelsystem_error("Unable to load needed angeltypes by filter."); - } - - $SQL = "SELECT `NeededAngelTypes`.*, `shifts_view`.`SID`, `AngelTypes`.`id`, `AngelTypes`.`name`, `AngelTypes`.`restricted`, `AngelTypes`.`no_self_signup` - FROM `shifts_view` - JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`shifts_view`.`SID` - JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id` - WHERE `shifts_view`.`PSID` IS NULL"; - $result1 = sql_select($SQL); - if ($result === false) { - engelsystem_error("Unable to load needed angeltypes by filter."); - } - $SQL = "SELECT `NeededAngelTypes`.*, `shifts_view`.`SID`, `AngelTypes`.`id`, `AngelTypes`.`name`, `AngelTypes`.`restricted`, `AngelTypes`.`no_self_signup` - FROM `shifts_view` - JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`shifts_view`.`RID` - JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id` - WHERE NOT `shifts_view`.`PSID` IS NULL"; - $result2 = sql_select($SQL); - if ($result === false) { - engelsystem_error("Unable to load needed angeltypes by filter."); - } - $result = array_merge($result1, $result2); -// echo microtime(true)-$time_start;die(); return $result; }