From 1845739081c894014b0d48cb9f20c2290145ba77 Mon Sep 17 00:00:00 2001 From: Francis Ganya Date: Sun, 20 Nov 2016 18:46:59 +0200 Subject: [PATCH] fixed voteBug --- Game/Assets/js/components/PlayComponents.js | 50 +++++++++++++-------- Game/Assets/js/dev/PlayComponents.js | 50 +++++++++++++-------- 2 files changed, 62 insertions(+), 38 deletions(-) diff --git a/Game/Assets/js/components/PlayComponents.js b/Game/Assets/js/components/PlayComponents.js index bd5efde..6a02925 100644 --- a/Game/Assets/js/components/PlayComponents.js +++ b/Game/Assets/js/components/PlayComponents.js @@ -411,7 +411,7 @@ var VotingWindow=React.createClass({displayName: "VotingWindow", var votables=this.state.votables; if(votables.length==0){ var master=this.props.master; - var players=master.state.contestants; + var players=master.state.activeContestants; var votes=this.state.votes; players.map(function(player,index){ @@ -586,7 +586,7 @@ var GameController=React.createClass({displayName: "GameController", * @var game -holds the game Object * @vars c_player and c_round holds the current player index and the current round number respectively */ - return {contestants:[],game:new Game(),c_player:0,c_round:0} + return {activeContestants:[],contestants:[],game:new Game(),c_player:0,c_round:0} }, /** * Get game data and initialise player Objects @@ -612,7 +612,7 @@ var GameController=React.createClass({displayName: "GameController", if(index==0) currentPlayer.state="active"; playerArr.push(currentPlayer); }); - this.setState({contestants:playerArr}); + this.setState({activeContestants:playerArr,contestants:playerArr.slice(0,playerArr.length),MAX_ROUNDS:(playerArr.length-2)}); this.state.game.id=gameInfo.game_id; } catch(err) @@ -654,14 +654,14 @@ var GameController=React.createClass({displayName: "GameController", msg.push("GoodBye!!"); host.notifyPlayers(msg,function(){ //remove the player - var players=this.state.contestants; + var players=this.state.activeContestants; for(var i=0;i - + - + );