diff --git a/Handler/CreateChallenge.hs b/Handler/CreateChallenge.hs index 02833c0..d3eea85 100644 --- a/Handler/CreateChallenge.hs +++ b/Handler/CreateChallenge.hs @@ -92,7 +92,8 @@ addChallenge name publicRepoId privateRepoId chan = do challengeTitle=(T.pack $ title), challengeDescription=(T.pack $ description), challengeStamp=time, - challengeImage=mImage } + challengeImage=mImage, + challengeStarred=Just False} updateTests challengeId chan return () diff --git a/Handler/Home.hs b/Handler/Home.hs index ab3c15b..9e19e1a 100644 --- a/Handler/Home.hs +++ b/Handler/Home.hs @@ -3,6 +3,7 @@ module Handler.Home where import Import import Handler.Shared +import Handler.ListChallenges -- This is a handler function for the GET request method on the HomeR -- resource pattern. All of your resource patterns are defined in @@ -15,6 +16,9 @@ getHomeR :: Handler Html getHomeR = do maybeUser <- maybeAuth master <- getYesod + + starredChallenges <- runDB $ selectList [ChallengeStarred ==. Just True] [Asc ChallengeStarred, Desc ChallengeStamp] + let maybeLocalId = case maybeUser of Just user -> userLocalId $ entityVal user Nothing -> Nothing diff --git a/Handler/ListChallenges.hs b/Handler/ListChallenges.hs index ca061a9..7edb161 100644 --- a/Handler/ListChallenges.hs +++ b/Handler/ListChallenges.hs @@ -4,7 +4,7 @@ import Import getListChallengesR :: Handler Html getListChallengesR = do - challenges <- runDB $ selectList [] [Desc ChallengeStamp] + challenges <- runDB $ selectList [] [Asc ChallengeStarred, Desc ChallengeStamp] defaultLayout $ do setTitle "List challenges" $(widgetFile "list-challenges") diff --git a/config/models b/config/models index 3d0575b..410948a 100644 --- a/config/models +++ b/config/models @@ -37,6 +37,7 @@ Challenge description Text stamp UTCTime default=now() image ByteString Maybe + starred Bool Maybe Test challenge ChallengeId metric Metric diff --git a/templates/homepage.hamlet b/templates/homepage.hamlet index 47d43ea..3fc7265 100644 --- a/templates/homepage.hamlet +++ b/templates/homepage.hamlet @@ -28,4 +28,10 @@
How to log in? If you already have an account, just click log in. Otherwise, please get in touch with the site admin#{contactEmailLabel master}. -
*Disclaimer: Gonito is neither affiliated with nor endorsed by Kaggle. +
*Disclaimer: Gonito is neither affiliated with nor endorsed by Kaggle. + + $if not (null starredChallenges) +
… and many more! diff --git a/templates/list-challenges-core.hamlet b/templates/list-challenges-core.hamlet index c3915a6..c3b5f9c 100644 --- a/templates/list-challenges-core.hamlet +++ b/templates/list-challenges-core.hamlet @@ -1,6 +1,8 @@ $forall (Entity challengeId challenge) <- challenges