Renamed variables and added spacing.

This commit is contained in:
Ajay Ramachandran
2020-04-30 18:15:17 -04:00
parent 004f714924
commit abee010291

View File

@@ -112,15 +112,16 @@ async function autoModerateSubmission(submission, callback) {
return "Sponsor segment is over 80% of the video."; return "Sponsor segment is over 80% of the video.";
} else { } else {
let overlap = false; let overlap = false;
let response = await fetch("https://ai.neuralblock.app/api/getSponsorSegments?vid=" + submission.videoID); let response = await fetch("https://ai.neuralblock.app/api/getSponsorSegments?vid=" + submission.videoID);
if (!response.ok) return false; if (!response.ok) return false;
nb_predictions = await response.json(); let nbPredictions = await response.json();
for (const nb_seg of nb_predictions.sponsorSegments){ for (const nbSegment of nbPredictions.sponsorSegments) {
// The submission needs to be a subset of the widened NB prediction // The submission needs to be a subset of the widened NB prediction
// and at least 65% of NB's prediction. // and at least 65% of NB's prediction.
if (nb_seg[0]-2 <= submission.startTime && submission.endTime <= nb_seg[1]+2){ if (nbSegment[0] - 2 <= submission.startTime && submission.endTime <= nbSegment[1] + 2){
if ((submission.endTime - submission.startTime)/(nb_seg[1]-nb_seg[0]) >= 0.65){ if ((submission.endTime - submission.startTime) / (nbSegment[1]-nbSegment[0]) >= 0.65){
overlap = true; overlap = true;
break; break;
} }