Fix bug in games.js
parent
17f14573e9
commit
fe659184f4
|
@ -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;
|
||||
}
|
||||
|
|
Reference in New Issue