Implement sorted map and server votes fixes #19

This commit is contained in:
Chris Blanchard 2015-09-21 21:21:11 +01:00
parent 5f7a5ccd06
commit 4701df35a0

View file

@ -425,7 +425,13 @@ var ServerVoting = React.createClass({
render() { render() {
var self = this; var self = this;
let servers = self.props.servers.map(server => { let servers = self.props.servers
.sort((a, b) => {
var aVotes = self.votesForServer(a);
var bVotes = self.votesForServer(b);
return bVotes - aVotes;
})
.map(server => {
let votes = self.votesForServer(server); let votes = self.votesForServer(server);
if (self.props.currentGatherer.serverVote === server.id) { if (self.props.currentGatherer.serverVote === server.id) {
return ( return (
@ -485,7 +491,13 @@ var MapVoting = React.createClass({
render() { render() {
var self = this; var self = this;
let maps = self.props.maps.map(map => { let maps = self.props.maps
.sort((a, b) => {
var aVotes = self.votesForMap(a);
var bVotes = self.votesForMap(b);
return bVotes - aVotes;
})
.map(map => {
let votes = self.votesForMap(map); let votes = self.votesForMap(map);
if (self.props.currentGatherer.mapVote === map.id) { if (self.props.currentGatherer.mapVote === map.id) {
return ( return (