Fix issues involving editing and submitting games

main
sudoer777 2021-11-24 20:36:00 -07:00
parent 48c2ee67bd
commit 0a6c56e103
3 changed files with 4 additions and 2 deletions

View File

@ -25,6 +25,8 @@ async function initializeForm() {
const game = await Data.getGame(gameID); const game = await Data.getGame(gameID);
Form.addHiddenValue('game', gameID, submissionForm);
Form.populateSeasons(seasonDropdown, game.seasonID); Form.populateSeasons(seasonDropdown, game.seasonID);
Data.getDivision(game.divisionID) Data.getDivision(game.divisionID)
.then(data => { .then(data => {

View File

@ -35,7 +35,7 @@ router.post('/game', function(req, res, next) {
if(remove) games.remove(id) if(remove) games.remove(id)
.then(res.redirect("/manage")); .then(res.redirect("/manage"));
else if(id) games.edit(id, divisionId, seasonID, date, team1ID, team2ID, team1Score, team2Score) else if(id) games.edit(id, divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score)
.then(res.redirect('/manage')); .then(res.redirect('/manage'));
else games.add(divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score) else games.add(divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score)
.then(res.redirect("/manage")); .then(res.redirect("/manage"));

View File

@ -7,7 +7,7 @@ block stylesheets
block content block content
div#mobile-view div#mobile-view
h1 #{title} h1 #{title}
form#submission-form(action='./submitgame', method='POST') form#submission-form(action='./game', method='POST')
span(class='form-section') span(class='form-section')
label Year label Year
span(class='form-section-input') span(class='form-section-input')