]> git.cworth.org Git - lmno.games/commitdiff
Fix category voting to select among only those with the most votes
authorCarl Worth <cworth@cworth.org>
Mon, 29 Jun 2020 21:56:16 +0000 (14:56 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 29 Jun 2020 21:56:16 +0000 (14:56 -0700)
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

index b9579a6893e2a9b91ea28f8da34da2182e4c75b9..001dcd5eeeb5ac3f943d368f971f8a78d19981d3 100644 (file)
@@ -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];