Fix bug in games.js
parent
17f14573e9
commit
fe659184f4
|
@ -58,12 +58,17 @@ async function retrieve(teamID, divisionID, seasonID) {
|
||||||
|
|
||||||
const gamesList = [];
|
const gamesList = [];
|
||||||
table.forEach((row) => {
|
table.forEach((row) => {
|
||||||
opponentIsTeam2 = teamID != row[5];
|
if(teamID) {
|
||||||
opponentID = opponentIsTeam2 ? row[5] : row[4];
|
const opponentIsTeam2 = teamID != row[5];
|
||||||
teamScore = opponentIsTeam2 ? row[6] : row[7];
|
const opponentID = opponentIsTeam2 ? row[5] : row[4];
|
||||||
opponentScore = opponentIsTeam2 ? row[7] : row[6];
|
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]));
|
|
||||||
|
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;
|
return gamesList;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue