Made it only count a contribution if it was uploaded successfully.

This commit is contained in:
Ajay Ramachandran
2019-07-31 23:47:04 -04:00
parent 015b283731
commit 35c3b5b97f

View File

@@ -147,15 +147,8 @@ function submitTimes(videoID, callback) {
callback({ callback({
statusCode: xmlhttp.status statusCode: xmlhttp.status
}); });
} else if (error) {
callback({
statusCode: -1
});
}
});
});
}
if (xmlhttp.status == 200) {
//add these to the storage log //add these to the storage log
chrome.storage.sync.get(["sponsorTimesContributed"], function(result) { chrome.storage.sync.get(["sponsorTimesContributed"], function(result) {
let currentContributionAmount = 0; let currentContributionAmount = 0;
@@ -168,6 +161,15 @@ function submitTimes(videoID, callback) {
chrome.storage.sync.set({"sponsorTimesContributed": currentContributionAmount + sponsorTimes.length}); chrome.storage.sync.set({"sponsorTimesContributed": currentContributionAmount + sponsorTimes.length});
}); });
} }
} else if (error) {
callback({
statusCode: -1
});
}
});
});
}
}
}); });
} }