Convert a boolean value to a non-maybe

This commit is contained in:
Filip Gralinski 2018-11-17 09:49:25 +01:00
parent e3d6117590
commit 62e282f136
5 changed files with 6 additions and 6 deletions

View File

@ -127,7 +127,7 @@ changeSubmissionVisibility status submissionId =
if isOwner
then
do
runDB $ update submissionId [SubmissionIsHidden =. Just (not status)]
runDB $ update submissionId [SubmissionIsHidden =. (not status)]
setMessage $ toHtml (("Submission " :: Text) ++ (verb status))
else
setMessage $ toHtml ("Only owner can edit a submission!!!" :: Text)

View File

@ -253,7 +253,7 @@ doCreateSubmission userId challengeId mDescription mTags repoSpec chan = do
bestResultSoFar <- runDB $ E.select $ E.from $ \(evaluation, submission, variant, out) -> do
E.where_ (submission ^. SubmissionChallenge E.==. E.val challengeId
E.&&. submission ^. SubmissionIsHidden E.!=. E.val (Just True)
E.&&. submission ^. SubmissionIsHidden E.==. E.val False
E.&&. variant ^. VariantSubmission E.==. submission ^. SubmissionId
E.&&. evaluation ^. EvaluationChecksum E.==. out ^. OutChecksum
E.&&. (E.not_ (E.isNothing (evaluation ^. EvaluationScore)))
@ -383,7 +383,7 @@ getSubmission userId repoId commit challengeId description chan = do
submissionStamp=time,
submissionSubmitter=userId,
submissionIsPublic=False,
submissionIsHidden=Just False }
submissionIsHidden=False }
getOuts :: Channel -> Key Submission -> M.Map Text Text -> Handler ([Out])
getOuts chan submissionId generalParams = do

View File

@ -254,7 +254,7 @@ getChallengeSubmissionInfos condition challengeId = do
allSubmissionsVariants <- E.select $ E.from $ \(submission, variant) -> do
E.where_ (submission ^. SubmissionChallenge E.==. E.val challengeId
E.&&. submission ^. SubmissionIsHidden E.!=. E.val (Just True)
E.&&. submission ^. SubmissionIsHidden E.==. E.val False
E.&&. variant ^. VariantSubmission E.==. submission ^. SubmissionId)
return (submission, variant)

View File

@ -57,7 +57,7 @@ Submission
stamp UTCTime default=now()
submitter UserId
isPublic Bool default=False
isHidden Bool Maybe
isHidden Bool default=False
UniqueSubmissionRepoCommitChallenge repo commit challenge
Variant
submission SubmissionId

View File

@ -25,7 +25,7 @@ $maybe variantId <- mVariantId
_{MsgSubmit} <span class="glyphicon glyphicon-upload"></span>
<hr>
$if submissionIsHidden submission == Just True
$if submissionIsHidden submission == True
<p>Submission is hidden!
<p>
<a href=@{RestoreSubmissionR submissionId}>_{MsgRestoreSubmission}