reduce number of sql queries on shift calendar

main
msquare 8 years ago
parent deb41c4b64
commit b3f92834b0

@ -87,14 +87,15 @@ function NeededAngelTypes_by_shift($shiftId) {
$shift_entries = ShiftEntries_by_shift($shiftId); $shift_entries = ShiftEntries_by_shift($shiftId);
$needed_angeltypes = []; $needed_angeltypes = [];
foreach ($needed_angeltypes_source as $angeltype) { foreach ($needed_angeltypes_source as $angeltype) {
$angeltype['shift_entries'] = [];
$angeltype['taken'] = 0; $angeltype['taken'] = 0;
foreach($shift_entries as $shift_entry) { foreach ($shift_entries as $shift_entry) {
if($shift_entry['TID']==$angeltype['id'] && $shift_entry['freeloaded'] == 0) { if ($shift_entry['TID'] == $angeltype['angel_type_id'] && $shift_entry['freeloaded'] == 0) {
$angeltype['taken']++; $angeltype['taken'] ++;
$angeltype['shift_entries'][] = $shift_entry;
} }
} }
$angeltype['shift_entries'] = $shift_entries;
$needed_angeltypes[] = $angeltype; $needed_angeltypes[] = $angeltype;
} }

@ -131,8 +131,8 @@ function sql_select_db($db_name) {
function sql_select($query) { function sql_select($query) {
global $sql_connection; global $sql_connection;
echo $query . ";\n"; // echo $query . ";\n";
echo debug_string_backtrace() . "\n"; // echo debug_string_backtrace() . "\n";
$result = $sql_connection->query($query); $result = $sql_connection->query($query);
if ($result) { if ($result) {

Loading…
Cancel
Save