From 424dc329f556d658416d8b7e58c3d3cbb8ff74d7 Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Fri, 23 Jul 2021 20:01:50 +0200 Subject: [PATCH] Limit number of parameters shown --- Handler/Tables.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Handler/Tables.hs b/Handler/Tables.hs index 2fb49ac..7316b9b 100644 --- a/Handler/Tables.hs +++ b/Handler/Tables.hs @@ -138,6 +138,12 @@ descriptionCell mauthId = Table.widget "description" ( (getInfoLink s mauthId) tagEnts) +formatListWithLimit :: Int -> (a -> Text) -> [a] -> Text +formatListWithLimit limit fun l = (Data.Text.unwords $ map fun $ Import.take limit l) <> + (if length l <= limit + then "" + else " [...]") + descriptionToBeShown :: Submission -> Variant -> [Parameter] -> Text descriptionToBeShown s v params = (submissionDescription s) ++ (Data.Text.pack vdescription) ++ " " ++ paramsShown @@ -147,7 +153,8 @@ descriptionToBeShown s v params = (submissionDescription s) ++ (Data.Text.pack v "" else " " ++ r - paramsShown = Data.Text.unwords $ map formatParameter params + maximumNumberOfParamsShown = 8 + paramsShown = formatListWithLimit maximumNumberOfParamsShown formatParameter params extractScore :: TestReference -> TableEntry -> Maybe Evaluation extractScore k tableEntry = lookup k $ tableEntryMapping tableEntry