From: Benjamin Auder Date: Thu, 8 Apr 2021 20:13:47 +0000 (+0200) Subject: Adjustments X-Git-Url: https://git.auder.net/doc/html/scripts/pieces/current/img/%7B%7B?a=commitdiff_plain;h=3d9745ae10ba867e4c1ec6e848db29c5e293420b;p=vchess.git Adjustments --- diff --git a/client/src/components/ChallengeList.vue b/client/src/components/ChallengeList.vue index a354203b..cf4565ad 100644 --- a/client/src/components/ChallengeList.vue +++ b/client/src/components/ChallengeList.vue @@ -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'!"] }} diff --git a/client/src/components/GameList.vue b/client/src/components/GameList.vue index ed6b99fa..0d488e51 100644 --- a/client/src/components/GameList.vue +++ b/client/src/components/GameList.vue @@ -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( diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index b13e3832..a2afb09d 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -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()" diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 1bd5987c..c9a15eaa 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -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 diff --git a/server/models/Game.js b/server/models/Game.js index 8cc526fe..0847c811 100644 --- a/server/models/Game.js +++ b/server/models/Game.js @@ -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,