From 0a6c56e103d94f45a9260f334e537f5125c24901 Mon Sep 17 00:00:00 2001 From: sudoer777 <78781902+sudoer777@users.noreply.github.com> Date: Wed, 24 Nov 2021 20:36:00 -0700 Subject: [PATCH] Fix issues involving editing and submitting games --- public/scripts/manage/game.js | 2 ++ routes/manage.js | 2 +- views/manage/addgame.pug | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/scripts/manage/game.js b/public/scripts/manage/game.js index 0cc134b..82d4cb8 100644 --- a/public/scripts/manage/game.js +++ b/public/scripts/manage/game.js @@ -25,6 +25,8 @@ async function initializeForm() { const game = await Data.getGame(gameID); + Form.addHiddenValue('game', gameID, submissionForm); + Form.populateSeasons(seasonDropdown, game.seasonID); Data.getDivision(game.divisionID) .then(data => { diff --git a/routes/manage.js b/routes/manage.js index 9757e69..16f8ca4 100644 --- a/routes/manage.js +++ b/routes/manage.js @@ -35,7 +35,7 @@ router.post('/game', function(req, res, next) { if(remove) games.remove(id) .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')); else games.add(divisionID, seasonID, date, team1ID, team2ID, team1Score, team2Score) .then(res.redirect("/manage")); diff --git a/views/manage/addgame.pug b/views/manage/addgame.pug index 039bfd1..7981148 100644 --- a/views/manage/addgame.pug +++ b/views/manage/addgame.pug @@ -7,7 +7,7 @@ block stylesheets block content div#mobile-view h1 #{title} - form#submission-form(action='./submitgame', method='POST') + form#submission-form(action='./game', method='POST') span(class='form-section') label Year span(class='form-section-input')