Fix bug in games.js

main
sudoer777 2021-11-22 16:13:21 -07:00
parent 17f14573e9
commit fe659184f4
1 changed files with 11 additions and 6 deletions

View File

@ -58,12 +58,17 @@ async function retrieve(teamID, divisionID, seasonID) {
const gamesList = [];
table.forEach((row) => {
opponentIsTeam2 = teamID != row[5];
opponentID = opponentIsTeam2 ? row[5] : row[4];
teamScore = opponentIsTeam2 ? row[6] : row[7];
opponentScore = opponentIsTeam2 ? row[7] : row[6];
if(teamID) {
const opponentIsTeam2 = teamID != row[5];
const opponentID = opponentIsTeam2 ? row[5] : row[4];
const teamScore = opponentIsTeam2 ? row[6] : row[7];
const opponentScore = opponentIsTeam2 ? row[7] : row[6];
gamesList.push(new Game(row[0], row[3].toISOString().slice(0,10), teamID, opponentID, teamScore, opponentScore, row[1], row[2]));
}
else {
gamesList.push(new Game(row[0], row[3].toISOString().slice(0,10), row[4], row[5], row[6], row[7], row[1], row[2]));
}
});
return gamesList;
}