move data sorting to begin
This commit is contained in:
parent
cbeb45ef16
commit
6c4bb0da31
|
@ -132,8 +132,25 @@ function view_user_shifts() {
|
|||
$shiftsFilter = $_SESSION['ShiftsFilter'];
|
||||
|
||||
$shifts = Shifts_by_ShiftsFilter($shiftsFilter);
|
||||
$needed_angeltypes = NeededAngeltypes_by_ShiftsFilter($shiftsFilter);
|
||||
$shift_entries = ShiftEntries_by_ShiftsFilter($shiftsFilter);
|
||||
$needed_angeltypes_source = NeededAngeltypes_by_ShiftsFilter($shiftsFilter);
|
||||
$shift_entries_source = ShiftEntries_by_ShiftsFilter($shiftsFilter);
|
||||
|
||||
$needed_angeltypes = [];
|
||||
$shift_entries = [];
|
||||
foreach ($shifts as $shift) {
|
||||
$needed_angeltypes[$shift['SID']] = [];
|
||||
$shift_entries[$shift['SID']] = [];
|
||||
}
|
||||
foreach ($needed_angeltypes_source as $needed_angeltype) {
|
||||
$needed_angeltypes[$needed_angeltype['SID']][] = $needed_angeltype;
|
||||
}
|
||||
foreach ($shift_entries_source as $shift_entry) {
|
||||
$shift_entries[$shift_entry['SID']][] = $shift_entry;
|
||||
}
|
||||
unset($needed_angeltypes_source);
|
||||
unset($shift_entries_source);
|
||||
|
||||
$shiftCalendarRenderer = new ShiftCalendarRenderer($shifts, $needed_angeltypes, $shift_entries, $shiftsFilter);
|
||||
|
||||
if ($user['api_key'] == "") {
|
||||
User_reset_api_key($user, false);
|
||||
|
@ -154,7 +171,6 @@ function view_user_shifts() {
|
|||
$end_day = date("Y-m-d", $shiftsFilter->getEndTime());
|
||||
$end_time = date("H:i", $shiftsFilter->getEndTime());
|
||||
|
||||
$shiftCalendarRenderer = new ShiftCalendarRenderer($shifts, $needed_angeltypes, $shift_entries, $shiftsFilter);
|
||||
return page([
|
||||
div('col-md-12', [
|
||||
msg(),
|
||||
|
|
|
@ -150,26 +150,13 @@ class ShiftCalendarRenderer {
|
|||
$html = "";
|
||||
$rendered_until = $this->getFirstBlockStartTime();
|
||||
|
||||
$needed_angeltypes = [];
|
||||
$shift_entries = [];
|
||||
foreach ($lane->getShifts() as $shift) {
|
||||
$needed_angeltypes[$shift['SID']] = [];
|
||||
$shift_entries[$shift['SID']] = [];
|
||||
}
|
||||
foreach ($this->needed_angeltypes as $needed_angeltype) {
|
||||
$needed_angeltypes[$needed_angeltype['SID']][] = $needed_angeltype;
|
||||
}
|
||||
foreach ($this->shift_entries as $shift_entry) {
|
||||
$shift_entries[$shift_entry['SID']][] = $shift_entry;
|
||||
}
|
||||
|
||||
foreach ($lane->getShifts() as $shift) {
|
||||
while ($rendered_until + ShiftCalendarRenderer::SECONDS_PER_ROW <= $shift['start']) {
|
||||
$html .= $this->renderTick($rendered_until);
|
||||
$rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW;
|
||||
}
|
||||
|
||||
list($shift_height, $shift_html) = $shift_renderer->render($shift, $needed_angeltypes[$shift['SID']], $shift_entries[$shift['SID']], $user);
|
||||
list($shift_height, $shift_html) = $shift_renderer->render($shift, $this->needed_angeltypes[$shift['SID']], $this->shift_entries[$shift['SID']], $user);
|
||||
$html .= $shift_html;
|
||||
$rendered_until += $shift_height * ShiftCalendarRenderer::SECONDS_PER_ROW;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue