Move 'anonymousCount' which was computed to a method in Hall. Seems more accurate
authorBenjamin Auder <benjamin.auder@somewhere>
Tue, 17 Mar 2020 10:40:32 +0000 (11:40 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Tue, 17 Mar 2020 10:40:32 +0000 (11:40 +0100)
client/src/components/BaseGame.vue
client/src/views/Hall.vue

index 612ded4..4162dfc 100644 (file)
@@ -291,7 +291,7 @@ export default {
       if (this.game.mode == "analyze") {
         this.$emit(
           "fenchange",
-          this.lastMove ? this.lastMove.fen : this.game.fenStart
+          !!this.lastMove ? this.lastMove.fen : this.game.fenStart
         );
       }
     },
index eb8464a..8f86f4c 100644 (file)
@@ -120,7 +120,7 @@ main
               @click="challenge(sid)"
             )
               | {{ st.tr["Challenge"] }}
-          p.anonymous @nonymous ({{ anonymousCount }})
+          p.anonymous @nonymous ({{ anonymousCount() }})
         #chat
           Chat(
             :newChat="newChat"
@@ -266,16 +266,6 @@ export default {
         this.loadNewchallVariant();
     }
   },
-  computed: {
-    anonymousCount: function() {
-      let count = 0;
-      Object.values(this.people).forEach(p => {
-        // Do not cound people who did not send their identity yet:
-        count += (!p.name && p.id === 0) ? 1 : 0;
-      });
-      return count;
-    }
-  },
   created: function() {
     if (this.st.variants.length > 0 && this.newchallenge.vid > 0)
       this.loadNewchallVariant();
@@ -436,6 +426,14 @@ export default {
         ["random-" + pc.randomness]: true
       };
     },
+    anonymousCount: function() {
+      let count = 0;
+      Object.values(this.people).forEach(p => {
+        // Do not cound people who did not send their identity yet:
+        count += (!p.name && p.id === 0) ? 1 : 0;
+      });
+      return count;
+    },
     visibilityChange: function() {
       // TODO: Use document.hidden? https://webplatform.news/issues/2019-03-27
       this.send(