performance improvements for displaying shifts

main
Jan-Philipp Litza 13 years ago
parent c925f19a96
commit d3b51174b6

@ -210,13 +210,12 @@ function user_shifts() {
'comment' => "" 'comment' => ""
)); ));
} else { } else {
$shifts = sql_select("SELECT * FROM `Shifts` ORDER BY `start`"); $shifts = sql_select("SELECT COUNT(*) AS `count` FROM `Shifts` ORDER BY `start`");
$days = array (); $days = array ();
$rooms = array (); $rooms = array ();
if (count($shifts) > 0) { if ($shifts[0]["count"] > 0) {
foreach ($shifts as $shift) $days = sql_select("SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) FROM `Shifts`");
$days[] = date("Y-m-d", $shift['start']); $days = array_map('array_pop', $days);
$days = array_unique($days);
$day = $days[0]; $day = $days[0];
if (isset ($_REQUEST['day'])) if (isset ($_REQUEST['day']))
$day = $_REQUEST['day']; $day = $_REQUEST['day'];

Loading…
Cancel
Save