From: Carl Worth Date: Mon, 29 Jun 2020 21:56:16 +0000 (-0700) Subject: Fix category voting to select among only those with the most votes X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=commitdiff_plain;h=49a7e9338a8160363ede955ae0d036abc360a359;ds=sidebyside 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. --- 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];