mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-09-20 04:54:00 +02:00
Fixed it not checking if there are more than 4 choices to choose from.
This commit is contained in:
parent
79fd1fe95e
commit
a213d2be02
1 changed files with 3 additions and 1 deletions
4
index.js
4
index.js
|
@ -241,7 +241,9 @@ function getVoteOrganisedSponsorTimes(sponsorTimes, votes, UUIDs) {
|
|||
}
|
||||
|
||||
//if there are too many indexes, find the best 4
|
||||
finalSponsorTimeIndexes = getWeightedRandomChoice(finalSponsorTimeIndexes, votes, 4).finalChoices;
|
||||
if (finalSponsorTimeIndexes.length > 4) {
|
||||
finalSponsorTimeIndexes = getWeightedRandomChoice(finalSponsorTimeIndexes, votes, 4).finalChoices;
|
||||
}
|
||||
|
||||
//convert this to a final array to return
|
||||
let finalSponsorTimes = [];
|
||||
|
|
Loading…
Reference in a new issue