Fixed weighted random cap not working.

Nothing would return if there were more than 4 sponsors.
This commit is contained in:
Ajay Ramachandran
2019-10-20 21:52:25 -04:00
parent 55a56c3e04
commit a6821209d1

View File

@@ -740,11 +740,9 @@ function getVoteOrganisedSponsorTimes(sponsorTimes, votes, UUIDs) {
let voteSums = weightedRandomIndexes.weightSums; let voteSums = weightedRandomIndexes.weightSums;
//convert these into the votes //convert these into the votes
for (let i = 0; i < voteSums.length; i++) { for (let i = 0; i < finalSponsorTimeIndexes.length; i++) {
if (voteSums[i] != undefined) { //it should use the sum of votes, since anyone upvoting a similar sponsor is upvoting the existence of that sponsor.
//it should use the sum of votes, since anyone upvoting a similar sponsor is upvoting the existence of that sponsor. votes[finalSponsorTimeIndexes[i]] = voteSums[i];
votes[finalSponsorTimeIndexes[i]] = voteSums;
}
} }
//find the indexes never dealt with and add them //find the indexes never dealt with and add them