From 49a7e9338a8160363ede955ae0d036abc360a359 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 29 Jun 2020 14:56:16 -0700 Subject: [PATCH] Fix category voting to select among only those with the most votes Previously, the code was selecting randomly among all categories with at least a quorum of votes. With this commit, the code now does what was intended, by selecting randomly only among the categories that are tied for the most votes. --- empathy/empathy.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index b9579a6..001dcd5 100644 --- a/empathy/empathy.jsx +++ b/empathy/empathy.jsx @@ -440,7 +440,7 @@ const LetsPlay = React.memo(props => { if (max_votes < quorum) return null; - const candidates = props.prompts.filter(p => p.votes.length >= quorum); + const candidates = props.prompts.filter(p => p.votes.length >= max_votes); const index = Math.floor(Math.random() * candidates.length); const winner = candidates[index]; -- 2.43.0