Return submitterName on games retreive from database function
parent
c882c4f402
commit
cd1f17803b
|
@ -50,14 +50,14 @@ async function retrieve(teamID, divisionID, seasonID) {
|
||||||
let table;
|
let table;
|
||||||
|
|
||||||
if(teamID && divisionID && seasonID) {
|
if(teamID && divisionID && seasonID) {
|
||||||
const query = `SELECT game_id, division_id, season_id, game_date, team1_id, team2_id, team1_score, team2_score, submitter_id
|
const query = `SELECT game_id, division_id, season_id, game_date, team1_id, team2_id, team1_score, team2_score, submitter_id, submitter_name
|
||||||
FROM scores.games
|
FROM scores.games
|
||||||
WHERE (team1_id = $1 OR team2_id = $1) AND division_id = $2 AND season_id = $3
|
WHERE (team1_id = $1 OR team2_id = $1) AND division_id = $2 AND season_id = $3
|
||||||
ORDER BY game_date DESC;`;
|
ORDER BY game_date DESC;`;
|
||||||
table = await database.executeQuery(query, [teamID,divisionID,seasonID]);
|
table = await database.executeQuery(query, [teamID,divisionID,seasonID]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const query = `SELECT game_id, division_id, season_id, game_date, team1_id, team2_id, team1_score, team2_score, submitter_id
|
const query = `SELECT game_id, division_id, season_id, game_date, team1_id, team2_id, team1_score, team2_score, submitter_id, submitter_name
|
||||||
FROM scores.games
|
FROM scores.games
|
||||||
ORDER BY game_date DESC;`;
|
ORDER BY game_date DESC;`;
|
||||||
table = await database.executeQuery(query);
|
table = await database.executeQuery(query);
|
||||||
|
@ -72,10 +72,10 @@ async function retrieve(teamID, divisionID, seasonID) {
|
||||||
const teamScore = opponentIsTeam2 ? row[6] : row[7];
|
const teamScore = opponentIsTeam2 ? row[6] : row[7];
|
||||||
const opponentScore = opponentIsTeam2 ? row[7] : row[6];
|
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], row[8]));
|
gamesList.push(new Game(row[0], row[3].toISOString().slice(0,10), teamID, opponentID, teamScore, opponentScore, row[1], row[2], row[8], row[9]));
|
||||||
}
|
}
|
||||||
else {
|
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], row[8]));
|
gamesList.push(new Game(row[0], row[3].toISOString().slice(0,10), row[4], row[5], row[6], row[7], row[1], row[2], row[8], row[9]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return gamesList;
|
return gamesList;
|
||||||
|
|
Reference in New Issue