Needs to be cleaned up. I'm kind of lost what's going on. I'm no expert in js though.
BUG:
If buses are not running, the current functionality just doesn't even update the UI when it gets a response.
function getWeather(success, failure) {
var now = new Date();
// Only check weather if buses are operating
// Buses operate M-F from 7 AM to 10 PM
if (now.getDay() >= 1 && now.getDay() <= 5) {
if (now.getHours() > 7 && now.getHours() < 22) {
console.log("stuff");
// Buses are operating
$.ajax({
url: "/weather"
}).done(function(result) {
return success(result);
}).fail(function() {
return failure();
});
}
}
}
Notice that nothing happens when the current time is when the buses aren't running. Neither of the success or failure functions are called.
Needs to be cleaned up. I'm kind of lost what's going on. I'm no expert in js though.
BUG: If buses are not running, the current functionality just doesn't even update the UI when it gets a response.
Notice that nothing happens when the current time is when the buses aren't running. Neither of the success or failure functions are called.