X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=60f62917226af3c9b2fa3c528e774c1ff25ce1d0;hb=cd0d7743323309fcfd241ccba959df81a77970c7;hp=e11e8e1377a680f1212d1b9ae59a2a70d2dda06e;hpb=c6788ecf8a595409c7e31febf3d13c97bde2a725;p=vchess.git diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index e11e8e13..60f62917 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -117,17 +117,21 @@ export default { computed: { uniquePlayers: function() { // Show e.g. "@nonymous (5)", and do nothing on click on anonymous - let anonymous = {id:0, name:"@nonymous", count:0}; - let playerList = []; + let anonymous = {name:"@nonymous", count:0}; + let playerList = {}; this.people.forEach(p => { if (p.id > 0) - playerList.push(p); + { + // We don't count registered users connections: either they are here or not. + if (!playerList[p.id]) + playerList[p.id] = {name: p.name, count: 0}; + } else anonymous.count++; }); if (anonymous.count > 0) - playerList.push(anonymous); - return playerList; + playerList[0] = anonymous; + return Object.values(playerList); }, }, created: function() { @@ -280,8 +284,9 @@ export default { // Ask identity, challenges and game(s) this.st.conn.send(JSON.stringify({code:"askidentity", target:sid})); this.st.conn.send(JSON.stringify({code:"askchallenge", target:sid})); - this.st.conn.send(JSON.stringify({code:"askgame", target:sid})); }); + // Also ask current games to all playing peers (TODO: some design issue) + this.st.conn.send(JSON.stringify({code:"askgames"})); break; } case "askidentity":