From 2ed724bf05339505d144530b7022da337ef2513e Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 1 Sep 2018 15:27:11 +0200 Subject: [PATCH] handle tags correctly in case of re-submission --- Handler/ShowChallenge.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Handler/ShowChallenge.hs b/Handler/ShowChallenge.hs index 081ab0b..2ad8ae5 100644 --- a/Handler/ShowChallenge.hs +++ b/Handler/ShowChallenge.hs @@ -243,7 +243,10 @@ doCreateSubmission userId challengeId mDescription mTags repoSpec chan = do submissionId <- getSubmission userId repoId (repoCurrentCommit repo) challengeId (fromMaybe (fromMaybe "???" mCommitDescription) mDescription) chan _ <- getOuts chan submissionId - runDB $ addTags submissionId (if isNothing mTags then mCommitTags else mTags) [] + currentTagIds <- runDB $ selectList [SubmissionTagSubmission ==. submissionId] [] + + runDB $ addTags submissionId (if isNothing mTags then mCommitTags else mTags) ( + map (submissionTagTag . entityVal) currentTagIds) msg chan "SUBMISSION CREATED" app <- getYesod