reduce number of sql queries on shift calendar

This commit is contained in:
msquare 2016-12-26 14:33:18 +01:00
parent deb41c4b64
commit b3f92834b0
2 changed files with 7 additions and 6 deletions

View File

@ -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) {
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;
}

View File

@ -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) {