Convert a boolean value to a non-maybe
This commit is contained in:
parent
e3d6117590
commit
62e282f136
@ -127,7 +127,7 @@ changeSubmissionVisibility status submissionId =
|
|||||||
if isOwner
|
if isOwner
|
||||||
then
|
then
|
||||||
do
|
do
|
||||||
runDB $ update submissionId [SubmissionIsHidden =. Just (not status)]
|
runDB $ update submissionId [SubmissionIsHidden =. (not status)]
|
||||||
setMessage $ toHtml (("Submission " :: Text) ++ (verb status))
|
setMessage $ toHtml (("Submission " :: Text) ++ (verb status))
|
||||||
else
|
else
|
||||||
setMessage $ toHtml ("Only owner can edit a submission!!!" :: Text)
|
setMessage $ toHtml ("Only owner can edit a submission!!!" :: Text)
|
||||||
|
@ -253,7 +253,7 @@ doCreateSubmission userId challengeId mDescription mTags repoSpec chan = do
|
|||||||
|
|
||||||
bestResultSoFar <- runDB $ E.select $ E.from $ \(evaluation, submission, variant, out) -> do
|
bestResultSoFar <- runDB $ E.select $ E.from $ \(evaluation, submission, variant, out) -> do
|
||||||
E.where_ (submission ^. SubmissionChallenge E.==. E.val challengeId
|
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.&&. variant ^. VariantSubmission E.==. submission ^. SubmissionId
|
||||||
E.&&. evaluation ^. EvaluationChecksum E.==. out ^. OutChecksum
|
E.&&. evaluation ^. EvaluationChecksum E.==. out ^. OutChecksum
|
||||||
E.&&. (E.not_ (E.isNothing (evaluation ^. EvaluationScore)))
|
E.&&. (E.not_ (E.isNothing (evaluation ^. EvaluationScore)))
|
||||||
@ -383,7 +383,7 @@ getSubmission userId repoId commit challengeId description chan = do
|
|||||||
submissionStamp=time,
|
submissionStamp=time,
|
||||||
submissionSubmitter=userId,
|
submissionSubmitter=userId,
|
||||||
submissionIsPublic=False,
|
submissionIsPublic=False,
|
||||||
submissionIsHidden=Just False }
|
submissionIsHidden=False }
|
||||||
|
|
||||||
getOuts :: Channel -> Key Submission -> M.Map Text Text -> Handler ([Out])
|
getOuts :: Channel -> Key Submission -> M.Map Text Text -> Handler ([Out])
|
||||||
getOuts chan submissionId generalParams = do
|
getOuts chan submissionId generalParams = do
|
||||||
|
@ -254,7 +254,7 @@ getChallengeSubmissionInfos condition challengeId = do
|
|||||||
|
|
||||||
allSubmissionsVariants <- E.select $ E.from $ \(submission, variant) -> do
|
allSubmissionsVariants <- E.select $ E.from $ \(submission, variant) -> do
|
||||||
E.where_ (submission ^. SubmissionChallenge E.==. E.val challengeId
|
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.&&. variant ^. VariantSubmission E.==. submission ^. SubmissionId)
|
||||||
return (submission, variant)
|
return (submission, variant)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ Submission
|
|||||||
stamp UTCTime default=now()
|
stamp UTCTime default=now()
|
||||||
submitter UserId
|
submitter UserId
|
||||||
isPublic Bool default=False
|
isPublic Bool default=False
|
||||||
isHidden Bool Maybe
|
isHidden Bool default=False
|
||||||
UniqueSubmissionRepoCommitChallenge repo commit challenge
|
UniqueSubmissionRepoCommitChallenge repo commit challenge
|
||||||
Variant
|
Variant
|
||||||
submission SubmissionId
|
submission SubmissionId
|
||||||
|
@ -25,7 +25,7 @@ $maybe variantId <- mVariantId
|
|||||||
_{MsgSubmit} <span class="glyphicon glyphicon-upload"></span>
|
_{MsgSubmit} <span class="glyphicon glyphicon-upload"></span>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
$if submissionIsHidden submission == Just True
|
$if submissionIsHidden submission == True
|
||||||
<p>Submission is hidden!
|
<p>Submission is hidden!
|
||||||
<p>
|
<p>
|
||||||
<a href=@{RestoreSubmissionR submissionId}>_{MsgRestoreSubmission}
|
<a href=@{RestoreSubmissionR submissionId}>_{MsgRestoreSubmission}
|
||||||
|
Loading…
Reference in New Issue
Block a user