query("SELECT `id` FROM log WHERE `type`='tour_scheduler' AND `result`='1' AND `year`='{$config['year']}' ORDER BY `id` DESC LIMIT 1"); if($q->num_rows != 1) { $r['running'] = false; $r['messages'] = ""; $r['percent'] = 0; } else { $d = $q->fetch_assoc(); /* Get all messages */ $r['running'] = true; $r['messages'] = ''; $q = $mysqli->query("SELECT * FROM log WHERE `id`>='{$d['id']}' AND `type`='tour_scheduler' AND year='{$config['year']}' ORDER BY `id`"); $last_message = ''; while($d = $q->fetch_assoc()) { if($last_message != $d['data']) { $r['messages'] .= $d['data']."
"; $last_message = $d['data']; } $r['percent'] = $d['result']; if($d['result'] == 100) { $r['running'] = false; } } } /* Get data from most recent run of the scheduler from the log */ print(json_encode($r)); exit(); case 'run': sfiab_log($mysqli, "tour_scheduler", $u, 1, "Initializing..."); $mysqli->real_query("INSERT INTO queue(`command`,`result`) VALUES('tour_scheduler','queued')"); queue_start($mysqli); form_ajax_response(array('status'=>0, )); exit(); } sfiab_page_begin($u, "Tours", $page_id); ?>
&$t) { /* Count max tour slots per grade */ for($g=$t['grade_min']; $g <= $t['grade_max']; $g++) { if(!array_key_exists($g, $stats['by_grade'])) { $stats['by_grade'][$g] = 0; } $stats['by_grade'][$g] += $t['capacity_max']; } $stats['max_total'] += $t['capacity_max']; $stats['min_total'] += $t['capacity_min']; } $stats['students_assigned'] = 0; $students = students_load_all_accepted($mysqli); foreach($students as $sid => &$s) { if($s['tour_id'] === NULL) continue; if($s['tour_id'] > 0) { $stats['students_assigned'] += 1; } } ?>

Stats

Tours

Tour Assignments

Individual students can be assigned to a Tour on the Student List/Editor pages.

The tour scheduler takes about a minute to run and will:


Scheduler Status

Status:
Output:

The complete output log is available here: Tour Scheduler Log