Show current challenge version

This commit is contained in:
Filip Gralinski 2019-12-13 22:29:41 +01:00
parent f5c480205e
commit 80020ee404
4 changed files with 9 additions and 4 deletions

View File

@ -499,3 +499,8 @@ runSlackHook hook message = do
slackLink :: App -> Text -> Text -> Text
slackLink app title addr = "<" ++ slink ++ "|" ++ title ++ ">"
where slink = (appRoot $ appSettings app) ++ "/" ++ addr
formatVersion :: (Int, Int, Int) -> Text
formatVersion (major, minor, patch) = (T.pack $ show major)
<> "." <> (T.pack $ show minor)
<> "." <> (T.pack $ show patch)

View File

@ -749,6 +749,9 @@ challengeLayout :: Bool -> Challenge -> WidgetFor App () -> HandlerFor App Html
challengeLayout withHeader challenge widget = do
tagsAvailableAsJSON <- runDB $ getAvailableTagsAsJSON
version <- runDB $ getBy404 $ UniqueVersionByCommit $ challengeVersion challenge
let versionFormatted = formatVersion ((versionMajor $ entityVal version),
(versionMinor $ entityVal version),
(versionPatch $ entityVal version))
maybeUser <- maybeAuth
bc <- widgetToPageContent widget
defaultLayout $ do

View File

@ -59,9 +59,6 @@ data TableEntry = TableEntry {
tableEntryStamp :: TableEntry -> UTCTime
tableEntryStamp = submissionStamp . entityVal . tableEntrySubmission
formatVersion :: (Int, Int, Int) -> Text
formatVersion (major, minor, patch) = (Data.Text.pack $ show major) <> "." <> (Data.Text.pack $ show minor) <> "." <> (Data.Text.pack $ show patch)
submissionsTable :: Maybe UserId -> Text -> RepoScheme -> Repo -> [Entity Test] -> Table App TableEntry
submissionsTable mauthId challengeName repoScheme challengeRepo tests = mempty
++ Table.int "#" tableEntryRank

View File

@ -15,7 +15,7 @@
<div class="panel-body">
$if withHeader
<h1>#{challengeTitle challenge}
<p>#{challengeDescription challenge}
<p>#{challengeDescription challenge} [ver. #{versionFormatted}]
$maybe deadline <- versionDeadline $ entityVal version
<p>Deadline: #{show deadline}
$nothing