diff options
author | msquare <msquare@notrademark.de> | 2016-12-26 14:33:18 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-12-26 14:33:18 +0100 |
commit | b3f92834b0d531d479b7d2f99dbe04fa30faf3f0 (patch) | |
tree | d2809f80b5d9d3291498586b23d422ef3fe8fa7f | |
parent | deb41c4b64a59301aceb63257388bb2707bc9a75 (diff) |
reduce number of sql queries on shift calendar
-rw-r--r-- | includes/model/NeededAngelTypes_model.php | 9 | ||||
-rw-r--r-- | includes/mysqli_provider.php | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/includes/model/NeededAngelTypes_model.php b/includes/model/NeededAngelTypes_model.php index 76796869..3bd3660f 100644 --- a/includes/model/NeededAngelTypes_model.php +++ b/includes/model/NeededAngelTypes_model.php @@ -87,14 +87,15 @@ function NeededAngelTypes_by_shift($shiftId) { $shift_entries = ShiftEntries_by_shift($shiftId); $needed_angeltypes = []; foreach ($needed_angeltypes_source as $angeltype) { + $angeltype['shift_entries'] = []; $angeltype['taken'] = 0; - foreach($shift_entries as $shift_entry) { - if($shift_entry['TID']==$angeltype['id'] && $shift_entry['freeloaded'] == 0) { - $angeltype['taken']++; + foreach ($shift_entries as $shift_entry) { + if ($shift_entry['TID'] == $angeltype['angel_type_id'] && $shift_entry['freeloaded'] == 0) { + $angeltype['taken'] ++; + $angeltype['shift_entries'][] = $shift_entry; } } - $angeltype['shift_entries'] = $shift_entries; $needed_angeltypes[] = $angeltype; } diff --git a/includes/mysqli_provider.php b/includes/mysqli_provider.php index b1fd5f4a..c81f157f 100644 --- a/includes/mysqli_provider.php +++ b/includes/mysqli_provider.php @@ -131,8 +131,8 @@ function sql_select_db($db_name) { function sql_select($query) { global $sql_connection; - echo $query . ";\n"; - echo debug_string_backtrace() . "\n"; +// echo $query . ";\n"; +// echo debug_string_backtrace() . "\n"; $result = $sql_connection->query($query); if ($result) { |