Fix live games
[vchess.git] / client / src / views / Hall.vue
index 1bd5987..05ee05b 100644 (file)
@@ -14,7 +14,7 @@ main
       p.text-center
         span.variantName
           | {{ curChallToAccept.vname }}
-          | {{ curChallToAccept.options.abridged }} 
+          | {{ curChallToAccept.options.abridged || '' }} 
         span {{ curChallToAccept.cadence }} 
         span {{ st.tr["with"] + " " + curChallToAccept.from.name }}
       p.text-center(v-if="!!curChallToAccept.color")
@@ -178,7 +178,7 @@ main
           )
             td {{ pc.vname }}
             td {{ pc.cadence }}
-            td(:class="getRandomnessClass(pc)") {{ pc.options.abridged }}
+            td(:class="getRandomnessClass(pc)") {{ pc.options.abridged || '' }}
             td.remove-preset(@click="removePresetChall($event, pc)")
               img(src="/images/icons/delete.svg")
   .row
@@ -479,7 +479,13 @@ export default {
       this.conn = null;
     },
     getRandomnessClass: function(pc) {
-      if (!pc.options.randomness) return {};
+      if (
+        // TODO: one extra test here
+        !Number.isInteger(pc.options.randomness) &&
+        !parseInt(pc.options.randomness, 10)
+      ) {
+        return {};
+      }
       return {
         ["random-" + pc.options.randomness]: true
       };
@@ -1397,7 +1403,8 @@ export default {
           moves: [],
           clocks: [-1, -1], //-1 = unstarted
           chats: [],
-          score: "*"
+          score: "*",
+          options: JSON.stringify(gameInfo.options)
         }
       );
       setTimeout(