From a66588619a640c9a1804bd8a5a62c34429a80542 Mon Sep 17 00:00:00 2001 From: Ajay Date: Tue, 3 May 2022 15:27:23 -0400 Subject: [PATCH] Fix rep hurting negatively voted segments --- src/routes/getSkipSegments.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/getSkipSegments.ts b/src/routes/getSkipSegments.ts index 237a3be..a9500f8 100644 --- a/src/routes/getSkipSegments.ts +++ b/src/routes/getSkipSegments.ts @@ -223,7 +223,8 @@ function getWeightedRandomChoice(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.max(1, choice.reputation + 1) + 3 + boost); + const repFactor = choice.votes > 0 ? Math.max(1, choice.reputation + 1) : 1; + const weight = Math.exp(choice.votes * repFactor + 3 + boost); totalWeight += Math.max(weight, 0); return { ...choice, weight };