X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=133a5f9e9ced98cc58dd59bd69292faa88260556;hb=cd49e617866590dbc68530ad961b109cdbe1ce55;hp=ee8d53e5a54f59c06ff97aa6ac738d7515eee25e;hpb=aef58d08d7c453f7ae7947e718c3bd6f092f02f2;p=vchess.git diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index ee8d53e5..133a5f9e 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -241,7 +241,9 @@ export default { vid: parseInt(localStorage.getItem("vid")) || 0, to: "", //name of challenged player (if any) cadence: localStorage.getItem("cadence") || "", - randomness: parseInt(localStorage.getItem("challRandomness")) || 2, + randomness: + // Warning: randomness can be 0, then !!randomness is false + (parseInt(localStorage.getItem("challRandomness"))+1 || 3) - 1, // VariantRules object, stored to not interfere with // diagrams of targetted challenges: V: null, @@ -820,9 +822,12 @@ export default { // Ignore games where I play (will go in MyGames page), // and also games that I already received. if ( - game.players.every(p => - p.sid != this.st.user.sid && p.id != this.st.user.id) && - this.games.findIndex(g => g.id == game.id) == -1 + game.players.every(p => { + return ( + p.sid != this.st.user.sid && + (p.id == 0 || p.id != this.st.user.id) + ); + }) && this.games.findIndex(g => g.id == game.id) == -1 ) { let newGame = game; newGame.type = this.classifyObject(game); @@ -1014,7 +1019,11 @@ export default { let chall = Object.assign({}, this.newchallenge); // Add only if not already issued (not counting target or FEN): if (this.challenges.some(c => - (c.from.sid == this.st.user.sid || c.from.id == this.st.user.id) && + ( + c.from.sid == this.st.user.sid || + (c.from.id > 0 && c.from.id == this.st.user.id) + ) + && c.vid == chall.vid && c.cadence == chall.cadence && c.randomness == chall.randomness @@ -1036,7 +1045,10 @@ export default { const c = this.challenges[i]; if ( c.type == ctype && - (c.from.sid == this.st.user.sid || c.from.id == this.st.user.id) + ( + c.from.sid == this.st.user.sid || + (c.from.id > 0 && c.from.id == this.st.user.id) + ) ) { countMyChalls++; if (c.added < oldestAdded) {