Fixed it not checking if there are more than 4 choices to choose from.

This commit is contained in:
Ajay Ramachandran
2019-07-17 17:13:43 -04:00
parent 79fd1fe95e
commit a213d2be02

View File

@@ -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 = [];