Add submitter to games in management panel
parent
d72e20b067
commit
aecdee3b51
|
@ -41,14 +41,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
|
const query = `SELECT game_id, division_id, season_id, game_date, team1_id, team2_id, team1_score, team2_score, submitter_id
|
||||||
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
|
const query = `SELECT game_id, division_id, season_id, game_date, team1_id, team2_id, team1_score, team2_score, submitter_id
|
||||||
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);
|
||||||
|
@ -63,10 +63,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]));
|
gamesList.push(new Game(row[0], row[3].toISOString().slice(0,10), teamID, opponentID, teamScore, opponentScore, row[1], row[2], row[8]));
|
||||||
}
|
}
|
||||||
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]));
|
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]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return gamesList;
|
return gamesList;
|
||||||
|
|
|
@ -232,6 +232,10 @@ CATEGORIES.push(new Category(
|
||||||
dateHeader.textContent = "Date";
|
dateHeader.textContent = "Date";
|
||||||
headerRow.appendChild(dateHeader);
|
headerRow.appendChild(dateHeader);
|
||||||
|
|
||||||
|
const submitterHeader = document.createElement('th');
|
||||||
|
submitterHeader.textContent = "Submitter";
|
||||||
|
headerRow.appendChild(submitterHeader);
|
||||||
|
|
||||||
itemsListTable.appendChild(headerRow);
|
itemsListTable.appendChild(headerRow);
|
||||||
},
|
},
|
||||||
function listGame(game, row) {
|
function listGame(game, row) {
|
||||||
|
@ -285,6 +289,11 @@ CATEGORIES.push(new Category(
|
||||||
dateSpan.textContent = game.date.slice(5);
|
dateSpan.textContent = game.date.slice(5);
|
||||||
dateCell.appendChild(dateSpan);
|
dateCell.appendChild(dateSpan);
|
||||||
row.appendChild(dateCell);
|
row.appendChild(dateCell);
|
||||||
|
|
||||||
|
const submitterCell = document.createElement('td');
|
||||||
|
Data.getAccount(game.submitterID)
|
||||||
|
.then(data => submitterCell.textContent = data.name);
|
||||||
|
row.appendChild(submitterCell);
|
||||||
},
|
},
|
||||||
async function addGame() {
|
async function addGame() {
|
||||||
window.location.href = "/manage/game";
|
window.location.href = "/manage/game";
|
||||||
|
|
Reference in New Issue