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
1 changed files with 14 additions and 2 deletions

View File

@ -425,7 +425,13 @@ var ServerVoting = React.createClass({
render() {
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);
if (self.props.currentGatherer.serverVote === server.id) {
return (
@ -485,7 +491,13 @@ var MapVoting = React.createClass({
render() {
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);
if (self.props.currentGatherer.mapVote === map.id) {
return (