]> git.cworth.org Git - empires-server/blobdiff - empathy.js
Use set difference (ANSWERED - JUDGED) to determine whether to advance
[empires-server] / empathy.js
index 7b27ee40c5d196866b19036455c66e6b5ebe713e..ba25cc4c49d7e996ba2c93505efc0ab2ba75b9d8 100644 (file)
@@ -663,7 +663,8 @@ router.post('/judged/:prompt_id([0-9]+)', (request, response) => {
 
   /* If every player who answered has also judged, then there's no
    * need to wait for anything else. */
-  if (game.state.players_judged.length >= game.state.players_answered.length)
+  const judged_set = new Set(game.state.players_judged);
+  if ([...game.state.players_answered].filter(x => !judged_set.has(x)).length === 0)
     game.compute_scores();
 });