reduce number of sql queries on shift calendar
This commit is contained in:
parent
deb41c4b64
commit
b3f92834b0
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue