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

Fix front-end to match new API

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