Skip to content

Commit

Permalink
fixes odota#722
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Nov 10, 2015
1 parent b587fe5 commit 8cea906
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ function getColumnInfo(db, cb) {

function insertMatch(db, redis, queue, match, options, cb) {
var players = match.players ? JSON.parse(JSON.stringify(match.players)) : undefined;
if (players) {
players.sort(function(a, b) {
return a.player_slot - b.player_slot;
});
}
delete match.players;
//options specify api, parse, or skill
//we want to insert into matches, then insert into player_matches for each entry in players
Expand Down Expand Up @@ -261,6 +266,7 @@ function insertMatch(db, redis, queue, match, options, cb) {
}
else {
//slot to id map so after parse we can figure out the player ids for each slot
//do this at the end so it doesn't get deleted during match insertion step
if (players) {
match.slot_to_id = {};
players.forEach(function(p) {
Expand Down

0 comments on commit 8cea906

Please sign in to comment.