From cd1f17803ba2e5b46be760993e002ea2ef2fd21f Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Tue, 7 Dec 2021 10:50:29 -0700 Subject: [PATCH] Return submitterName on games retreive from database function --- database/scores/games.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/database/scores/games.js b/database/scores/games.js index aa33213..5680c58 100644 --- a/database/scores/games.js +++ b/database/scores/games.js @@ -50,14 +50,14 @@ async function retrieve(teamID, divisionID, seasonID) { let table; 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 WHERE (team1_id = $1 OR team2_id = $1) AND division_id = $2 AND season_id = $3 ORDER BY game_date DESC;`; table = await database.executeQuery(query, [teamID,divisionID,seasonID]); } 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 ORDER BY game_date DESC;`; table = await database.executeQuery(query); @@ -72,10 +72,10 @@ async function retrieve(teamID, divisionID, seasonID) { 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], 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 { - 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;