Skip to content

Commit e31fa89

Browse files
Update background.js
1 parent b173a01 commit e31fa89

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

background.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function cacheStore(metric_string) {
8989
// caching the commit_id for 1000 days, but that can be modified accordingly
9090
console.log('Cache Store',metric_string)
9191
localStorage.setItem(latest_commit, metric_string)
92-
write_metric_values(metric_string)
92+
9393
// var today = new Date();
9494
// today.setTime(today.getTime() + (1000 * 24 * 60 * 60 * 1000));
9595
// var cookieExpiration = "cookieExpiration=" + today.toUTCString();
@@ -1022,12 +1022,14 @@ function analyze_boc() {
10221022
console.log(boc)
10231023
document.getElementById('bugs').style.background = '#ff0062'
10241024
document.getElementById('bugs').innerHTML = boc["Open_Bugs"] + " : " + boc["Closed_Bugs"]
1025+
setTimeout(() => {
1026+
delete_repo()
1027+
}, 1500);
10251028
} else {
10261029
console.log("Problems in calculating Bug Issues metric")
1030+
document.getElementById('bugs').style.background = '#ff0062'
1031+
document.getElementById('bugs').innerHTML = "0 : 0"
10271032
}
1028-
setTimeout(() => {
1029-
delete_repo()
1030-
}, 1500);
10311033
}
10321034
xhttp.send('boc_request');
10331035
}, 300);
@@ -1145,22 +1147,22 @@ function analyze_scm() {
11451147

11461148
function delete_repo() {
11471149
add_insights()
1148-
var req_url = "https://services.iittp.ac.in/gitq/delete/" + latest_commit
1149-
console.log(req_url)
1150-
document.body.style.background = "#ffffff";
1151-
setTimeout(() => {
1152-
var xhttp = new XMLHttpRequest();
1153-
xhttp.open("POST", req_url, "true");
1154-
xhttp.setRequestHeader('Content-type', "application/x-www-form-urlencoded");
1155-
xhttp.onreadystatechange = function () {
1156-
if (this.readyState == 4 && this.status == 200) {
1157-
console.log("Repo Has been deleted Successfully")
1158-
} else {
1159-
console.log("Problems in deleting the repository in the remote server")
1160-
}
1161-
}
1162-
xhttp.send('delete_request');
1163-
}, 300);
1150+
// var req_url = "https://services.iittp.ac.in/gitq/delete/" + latest_commit
1151+
// console.log(req_url)
1152+
// document.body.style.background = "#ffffff";
1153+
// setTimeout(() => {
1154+
// var xhttp = new XMLHttpRequest();
1155+
// xhttp.open("POST", req_url, "true");
1156+
// xhttp.setRequestHeader('Content-type', "application/x-www-form-urlencoded");
1157+
// xhttp.onreadystatechange = function () {
1158+
// if (this.readyState == 4 && this.status == 200) {
1159+
// console.log("Repo Has been deleted Successfully")
1160+
// } else {
1161+
// console.log("Problems in deleting the repository in the remote server")
1162+
// }
1163+
// }
1164+
// xhttp.send('delete_request');
1165+
// }, 300);
11641166

11651167
}
11661168

@@ -1189,7 +1191,7 @@ function download_repository() {
11891191
}, 2000);
11901192
setTimeout(() => {
11911193
analyze_boc()
1192-
}, 2500);
1194+
}, 3000);
11931195

11941196
} else {
11951197
console.log("Problems in downloading the repo!")
@@ -1213,6 +1215,7 @@ function fetch_from_database() {
12131215
document.getElementsByClassName("Box mb-3")[0].innerHTML = badges_final + entire_code;
12141216
setTimeout(() => {
12151217
cacheStore(this.responseText)
1218+
write_metric_values(this.responseText)
12161219
// generate badges on to screen
12171220
// add_insights()
12181221
}, 800);

0 commit comments

Comments
 (0)