From 9a681701e59f48847570be021c928005af044ac9 Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Mon, 15 Feb 2021 14:44:19 +0100 Subject: [PATCH] Add hash to leaderboard entries --- Handler/ShowChallenge.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Handler/ShowChallenge.hs b/Handler/ShowChallenge.hs index 0d8171f..f6317fd 100644 --- a/Handler/ShowChallenge.hs +++ b/Handler/ShowChallenge.hs @@ -76,6 +76,7 @@ instance ToJSON LeaderboardEntry where (leaderboardBestVariant entry) (leaderboardParams entry) , "times" .= leaderboardNumberOfSubmissions entry + , "hash" .= (fromSHA1ToText $ submissionCommit $ leaderboardBestSubmission entry) ] instance ToSchema LeaderboardEntry where @@ -90,8 +91,9 @@ instance ToSchema LeaderboardEntry where , ("version", stringSchema) , ("description", stringSchema) , ("times", intSchema) + , ("hash", stringSchema) ] - & required .~ [ "submitter", "when", "version", "description", "times" ] + & required .~ [ "submitter", "when", "version", "description", "times", "hash" ] declareLeaderboardSwagger :: Declare (Definitions Schema) Swagger