Make reputation take into account self downvotes

This commit is contained in:
Ajay Ramachandran
2021-06-20 12:57:32 -04:00
parent 1770608525
commit 96015d402b
4 changed files with 33 additions and 6 deletions

View File

@@ -173,8 +173,8 @@ function getWeightedRandomChoice<T extends VotableObject>(choices: T[], amountOf
//The 3 makes -2 the minimum votes before being ignored completely
//this can be changed if this system increases in popularity.
const weight = Math.exp(choice.votes * Math.min(1, choice.reputation + 1) + 3 + boost);
totalWeight += weight;
const weight = Math.exp(choice.votes * Math.max(1, choice.reputation + 1) + 3 + boost);
totalWeight += Math.max(weight, 0);
return {...choice, weight};
});