clean up starred

This commit is contained in:
Filip Gralinski 2018-01-25 16:43:50 +01:00
parent d38e14c07a
commit f263913c6b
5 changed files with 5 additions and 5 deletions

View File

@ -93,7 +93,7 @@ addChallenge name publicRepoId privateRepoId chan = do
challengeDescription=(T.pack $ description),
challengeStamp=time,
challengeImage=mImage,
challengeStarred=Just False}
challengeStarred=False}
updateTests challengeId chan
return ()

View File

@ -17,7 +17,7 @@ getHomeR = do
maybeUser <- maybeAuth
master <- getYesod
starredChallenges <- runDB $ selectList [ChallengeStarred ==. Just True] [Asc ChallengeStarred, Desc ChallengeStamp]
starredChallenges <- runDB $ selectList [ChallengeStarred ==. True] [Desc ChallengeStamp]
let maybeLocalId = case maybeUser of
Just user -> userLocalId $ entityVal user

View File

@ -4,7 +4,7 @@ import Import
getListChallengesR :: Handler Html
getListChallengesR = do
challenges <- runDB $ selectList [] [Asc ChallengeStarred, Desc ChallengeStamp]
challenges <- runDB $ selectList [] [Desc ChallengeStarred, Desc ChallengeStamp]
defaultLayout $ do
setTitle "List challenges"
$(widgetFile "list-challenges")

View File

@ -37,7 +37,7 @@ Challenge
description Text
stamp UTCTime default=now()
image ByteString Maybe
starred Bool Maybe
starred Bool
Test
challenge ChallengeId
metric Metric

View File

@ -1,7 +1,7 @@
$forall (Entity challengeId challenge) <- challenges
<div class="panel panel-success">
<div class="panel-heading"><a .challenge-link href="@{ShowChallengeR (challengeName challenge)}">#{challengeTitle challenge}</a>
$if challengeStarred challenge == Just True
$if challengeStarred challenge
\ <span class="glyphicon glyphicon-star-empty"></span>
$if isJust (challengeImage challenge)
<div class="panel-body" style="background-image:url(@{ChallengeImageR challengeId}); background-color:lightgrey; background-blend-mode:screen;background-size: 100%;">#{challengeDescription challenge}