Merge pull request #3 from tadakda/master

Fixed course status update error and set status update interval to 15 mins
This commit is contained in:
Sriram Hariharan
2018-09-08 19:15:59 -05:00
committed by GitHub
2 changed files with 21 additions and 16 deletions

View File

@@ -196,12 +196,14 @@ function updateTabs() {
});
}
setInterval(updateStatus, 2*60*1000);
const UPDATE_INTERVAL = 1000 * 60 * 15 // 15 mins
setInterval(updateStatus, UPDATE_INTERVAL);
function updateStatus() {
chrome.storage.sync.get('savedCourses', function (data) {
var courses = data.savedCourses;
for (let i = 0; i < courses.length; i++) {
try {
let c = courses[i];
var xhr = new XMLHttpRequest();
xhr.open("GET", c.link, false);
@@ -216,10 +218,13 @@ function updateStatus() {
}
c.registerlink = registerlink;
c.status = newstatus;
} catch (e) {
console.log('Not logged into UT Coursebook. Could not update class statuses.');
}
}
chrome.storage.sync.set({
savedCourses: courses
});
console.log("updated status' and registerlinks");
// console.log("updated status' and registerlinks");
});
}

View File

@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "UT Registration Plus",
"version": "0.2.0",
"version": "0.2.1",
"options_page": "options.html",
"description": "Improves the course registration process at the University of Texas at Austin!",
"permissions": ["tabs",