mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-09 04:57:04 +03:00
Merge pull request #3 from ajayyy/experimental
Fixed issues caused by last pull request
This commit is contained in:
4
index.js
4
index.js
@@ -117,7 +117,7 @@ app.get('/api/postVideoSponsorTimes', function (req, res) {
|
|||||||
|
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
//not a duplicate, execute query
|
//not a duplicate, execute query
|
||||||
db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?, ?, ?, ?)").run(videoID, startTime, endTime, UUID, userID, hashedIP, timeSubmitted);
|
db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?, ?, ?, ?, ?)").run(videoID, startTime, endTime, 0, UUID, userID, hashedIP, timeSubmitted);
|
||||||
|
|
||||||
res.sendStatus(200);
|
res.sendStatus(200);
|
||||||
} else {
|
} else {
|
||||||
@@ -241,7 +241,9 @@ function getVoteOrganisedSponsorTimes(sponsorTimes, votes, UUIDs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if there are too many indexes, find the best 4
|
//if there are too many indexes, find the best 4
|
||||||
|
if (finalSponsorTimeIndexes.length > 4) {
|
||||||
finalSponsorTimeIndexes = getWeightedRandomChoice(finalSponsorTimeIndexes, votes, 4).finalChoices;
|
finalSponsorTimeIndexes = getWeightedRandomChoice(finalSponsorTimeIndexes, votes, 4).finalChoices;
|
||||||
|
}
|
||||||
|
|
||||||
//convert this to a final array to return
|
//convert this to a final array to return
|
||||||
let finalSponsorTimes = [];
|
let finalSponsorTimes = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user