forked from filipg/gonito
link challenges in achievements
This commit is contained in:
parent
8bda241416
commit
28c3b231e8
@ -18,6 +18,7 @@ import qualified Yesod.Table as Table
|
|||||||
|
|
||||||
data AchievementInfo = AchievementInfo {
|
data AchievementInfo = AchievementInfo {
|
||||||
achievementInfoName :: Text,
|
achievementInfoName :: Text,
|
||||||
|
achievementInfoChallenge :: Entity Challenge,
|
||||||
achievementInfoDescription :: Maybe Text,
|
achievementInfoDescription :: Maybe Text,
|
||||||
achievementInfoPoints :: Int,
|
achievementInfoPoints :: Int,
|
||||||
achievementInfoDeadline :: UTCTime,
|
achievementInfoDeadline :: UTCTime,
|
||||||
@ -73,8 +74,12 @@ getAchievementInfo mUser (Entity achievementId achievement) = do
|
|||||||
|
|
||||||
tags <- getAchievementTags achievementId
|
tags <- getAchievementTags achievementId
|
||||||
|
|
||||||
|
let challengeId = achievementChallenge achievement
|
||||||
|
challenge <- get404 challengeId
|
||||||
|
|
||||||
return $ AchievementInfo {
|
return $ AchievementInfo {
|
||||||
achievementInfoName = achievementName achievement,
|
achievementInfoName = achievementName achievement,
|
||||||
|
achievementInfoChallenge = Entity challengeId challenge,
|
||||||
achievementInfoDescription = achievementDescription achievement,
|
achievementInfoDescription = achievementDescription achievement,
|
||||||
achievementInfoPoints = achievementPoints achievement,
|
achievementInfoPoints = achievementPoints achievement,
|
||||||
achievementInfoDeadline = achievementDeadline achievement,
|
achievementInfoDeadline = achievementDeadline achievement,
|
||||||
@ -93,6 +98,7 @@ getAchievementTags achievementId = do
|
|||||||
achievementsTable :: Table.Table App (AchievementInfo)
|
achievementsTable :: Table.Table App (AchievementInfo)
|
||||||
achievementsTable = mempty
|
achievementsTable = mempty
|
||||||
++ Table.text "achievement" achievementInfoName
|
++ Table.text "achievement" achievementInfoName
|
||||||
|
++ Table.linked "challenge" (challengeTitle . entityVal . achievementInfoChallenge) (ShowChallengeR . challengeName . entityVal . achievementInfoChallenge)
|
||||||
++ achievementDescriptionCell
|
++ achievementDescriptionCell
|
||||||
++ Table.int "points" achievementInfoPoints
|
++ Table.int "points" achievementInfoPoints
|
||||||
++ timestampCell "deadline" achievementInfoDeadline
|
++ timestampCell "deadline" achievementInfoDeadline
|
||||||
|
Loading…
Reference in New Issue
Block a user