]> git.cworth.org Git - empires-server/commitdiff
Only count players who participated in judging when determining quorum
authorCarl Worth <cworth@cworth.org>
Sat, 27 Jun 2020 15:00:20 +0000 (08:00 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 27 Jun 2020 15:00:46 +0000 (08:00 -0700)
Players who are inactive, (whether they registered and then never
submitted answers, or submitted answers but then didn't submit any
judging results), should not be able to sway the results of the
judging.

This commit fixes the failing test case of the previous commit so that
the entire test suite is passing once again.

empathy.js

index 4fdd4b329aa3eafeb39cf57c33df8fd953a65b7f..0ae52df96a442558124c0dd2f9e35dc572bc3f32 100644 (file)
@@ -410,7 +410,7 @@ class Empathy extends Game {
 
     /* Perform a (non-strict) majority ruling on equivalencies,
      * dropping all that didn't get enough votes. */
-    const quorum = Math.floor((this.players.length + 1)/2);
+    const quorum = Math.floor((this.state.players_judged.length + 1)/2);
     const agreed_equivalencies = Object.values(this.equivalencies).filter(
       eq => eq.count >= quorum);