]> git.cworth.org Git - lmno-server/commitdiff
Force all submitted judging words to lowercase before mapping
authorCarl Worth <cworth@cworth.org>
Fri, 12 Jun 2020 17:24:41 +0000 (10:24 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 12 Jun 2020 17:24:41 +0000 (10:24 -0700)
This fixes the bug revealed in the previous commit so that the test
suite now passes once again.

The server now doesn't apy attention to the capitalization that a
client happens to use when providing a judging submission, but will
treat things as equivalent regardless of case differences.

empathy.js

index e80c1af34e0644b13ba898c38d6e0ec464a5542b..cfe0618d76f211a0e3ceeb69b017c3c90a187100 100644 (file)
@@ -182,11 +182,13 @@ class Empathy extends Game {
             eq = [group[j], group[i]];
           }
 
-          const exist = this.equivalencies[`${eq[0]}:${eq[1]}`];
+          const key=`${this.canonize(eq[0])}:${this.canonize(eq[1])}`;
+
+          const exist = this.equivalencies[key];
           if (exist) {
             exist.count++;
           } else {
-            this.equivalencies[`${eq[0]}:${eq[1]}`] = {
+            this.equivalencies[key] = {
               count: 1,
               words: eq
             };