Adjustments
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 8 Apr 2021 20:13:47 +0000 (22:13 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 8 Apr 2021 20:13:47 +0000 (22:13 +0200)
client/src/components/ChallengeList.vue
client/src/components/GameList.vue
client/src/views/Game.vue
client/src/views/Hall.vue
server/models/Game.js

index a354203..cf4565a 100644 (file)
@@ -16,7 +16,7 @@ div
         td {{ c.vname }}
         td {{ withWho(c) }}
         td {{ c.cadence }}
-        td(:class="getRandomnessClass(c)") {{ c.options.abridged }}
+        td(:class="getRandomnessClass(c)") {{ c.options.abridged || '' }}
   p(v-else)
     | {{ st.tr["No challenges found :( Click on 'New game'!"] }}
 </template>
index ed6b99f..0d488e5 100644 (file)
@@ -13,7 +13,7 @@ div
         @click="$emit('show-game',g)"
         :class="{'my-turn': !!g.myTurn}"
       )
-        td {{ g.vname + '-' + g.options.abridged }}
+        td {{ g.vname + (g.options.abridged || '') }}
         td {{ player_s(g) }}
         td(v-if="showCadence") {{ g.cadence }}
         td(
index b13e383..a2afb09 100644 (file)
@@ -80,8 +80,7 @@ main
       span.variant-cadence(v-if="game.type!='import'") {{ game.cadence }}
       span.variant-name
         | {{ game.vname }}
-        | -
-        | {{ vr.constructor.AbbreviateOptions(game.options) }}
+        | {{ !!vr ? vr.constructor.AbbreviateOptions(game.options) : '' }}
       span#nextGame(
         v-if="nextIds.length > 0"
         @click="showNextGame()"
index 1bd5987..c9a15ea 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
index 8cc526f..0847c81 100644 (file)
@@ -132,7 +132,7 @@ const GameModel = {
   getObserved: function(uid, cursor, cb) {
     db.serialize(function() {
       let query =
-        "SELECT id, vid, cadence, created, score, white, black " +
+        "SELECT id, vid, cadence, options, created, score, white, black " +
         "FROM Games " +
         "WHERE created < " + cursor + " ";
       if (uid > 0) {
@@ -161,6 +161,7 @@ const GameModel = {
                   id: g.id,
                   vid: g.vid,
                   cadence: g.cadence,
+                  options: g.options,
                   created: g.created,
                   score: g.score,
                   players: [
@@ -180,7 +181,7 @@ const GameModel = {
   getRunning: function(uid, cb) {
     db.serialize(function() {
       let query =
-        "SELECT id, vid, cadence, created, white, black " +
+        "SELECT id, vid, cadence, options, created, white, black " +
         "FROM Games " +
         "WHERE score = '*' AND (white = " + uid + " OR black = " + uid + ")";
       db.all(query, (err, games) => {
@@ -210,6 +211,7 @@ const GameModel = {
                     id: g.id,
                     vid: g.vid,
                     cadence: g.cadence,
+                    options: g.options,
                     created: g.created,
                     score: g.score,
                     movesCount: movesCounts[g.id] || 0,
@@ -231,7 +233,7 @@ const GameModel = {
   getCompleted: function(uid, cursor, cb) {
     db.serialize(function() {
       let query =
-        "SELECT id, vid, cadence, created, score, scoreMsg, " +
+        "SELECT id, vid, cadence, options, created, score, scoreMsg, " +
           "white, black, deletedByWhite, deletedByBlack " +
         "FROM Games " +
         "WHERE " +
@@ -269,6 +271,7 @@ const GameModel = {
                   id: g.id,
                   vid: g.vid,
                   cadence: g.cadence,
+                  options: g.options,
                   created: g.created,
                   score: g.score,
                   scoreMsg: g.scoreMsg,