Commit 6c2ee6b4 authored by Renfred Harper's avatar Renfred Harper

Fix front-end to match new API

parent 6564a989
......@@ -70,8 +70,8 @@ function update_grid(facilities) {
// Special schedules take effect after 5am on their start day
// to prevent collisions with the previous night's schedule,
// and they end at 5am the day after their end date.
special_start = Date.parse(special.start + ' 05:00:00');
special_end = Date.parse(special.end + ' 05:00:00');
special_start = Date.parse(special.vaild_start + ' 05:00:00');
special_end = Date.parse(special.valid_end + ' 05:00:00');
special_end.setDate(special_end.getDate()+1);
if (now >= special_start && now <= special_end) {
schedule = special;
......@@ -139,9 +139,9 @@ function update_grid(facilities) {
}
$.ajax({
url: '/ajax/schedule/',
url: '/api/facilities/.json',
}).done(function (data) {
facilities = data.data;
facilities = data;
update_grid(facilities);
construct_grid(facilities);
// Every second, check and see if it is necessary to update the grid.
......
$.ajax({
url: '/ajax/schedule/',
url: '/api/facilities/.json',
}).done(function (data) {
//collecting list of facility names from server data
var rest_names = [];
for (var i = 0; i < data.data.length; i++) {
rest_names.push(data.data[i].name);
for (var i = 0; i < data.length; i++) {
rest_names.push(data[i].name);
};
// For doumentation on jQuery's autocomplete: (api.jqueryui.com/autocomplete)
$("#searchBar").autocomplete({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment