CC-4873: Airtime takes 7 seconds to load 32K (very small) from db
-further optimization by looking at the preferred time scale
This commit is contained in:
parent
2f3a30b580
commit
c3f2bf57de
|
@ -129,14 +129,19 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$user = new Application_Model_User($userInfo->id);
|
||||
$editable = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
|
||||
$calendar_interval = Application_Model_Preference::GetCalendarTimeInterval();
|
||||
$calendar_interval = Application_Model_Preference::GetCalendarTimeScale();
|
||||
Logging::info($calendar_interval);
|
||||
if ($calendar_interval == "agendaDay") {
|
||||
list($start, $end) = Application_Model_Show::getStartEndCurrentDayView();
|
||||
} else if ($calendar_interval == "agendaWeek") {
|
||||
list($start, $end) = Application_Model_Show::getStartEndCurrentWeekView();
|
||||
} else if ($calendar_interval == "month") {
|
||||
}
|
||||
list($start, $end) = Application_Model_Show::getStartEndCurrentMonthView();
|
||||
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
||||
} else {
|
||||
Logging::error("Invalid Calendar Interval '$calendar_interval'");
|
||||
}
|
||||
|
||||
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
||||
$this->view->events = $events;
|
||||
}
|
||||
|
||||
|
|
|
@ -2183,11 +2183,35 @@ SQL;
|
|||
while (date('w', $first_day_of_calendar_month_view) != $weekStart) {
|
||||
$first_day_of_calendar_month_view -= 60*60*24;
|
||||
}
|
||||
$last_day_of_calendar_view = $first_day_of_calendar_month_view + 3600*24*41;
|
||||
$last_day_of_calendar_view = $first_day_of_calendar_month_view + 3600*24*42;
|
||||
|
||||
$start = new DateTime("@".$first_day_of_calendar_month_view);
|
||||
$end = new DateTime("@".$last_day_of_calendar_view);
|
||||
|
||||
return array($start, $end);
|
||||
}
|
||||
|
||||
public static function getStartEndCurrentWeekView() {
|
||||
$first_day_of_calendar_week_view = mktime(0, 0, 0, date("n"), date("j"));
|
||||
$weekStart = Application_Model_Preference::GetWeekStartDay();
|
||||
while (date('w', $first_day_of_calendar_week_view) != $weekStart) {
|
||||
$first_day_of_calendar_week_view -= 60*60*24;
|
||||
}
|
||||
$last_day_of_calendar_view = $first_day_of_calendar_week_view + 3600*24*7;
|
||||
|
||||
$start = new DateTime("@".$first_day_of_calendar_week_view);
|
||||
$end = new DateTime("@".$last_day_of_calendar_view);
|
||||
|
||||
return array($start, $end);
|
||||
}
|
||||
|
||||
public static function getStartEndCurrentDayView() {
|
||||
$today = mktime(0, 0, 0, date("n"), date("j"));
|
||||
$tomorrow = $today + 3600*24;
|
||||
|
||||
$start = new DateTime("@".$today);
|
||||
$end = new DateTime("@".$tomorrow);
|
||||
|
||||
return array($start, $end);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue