style(corrections-overview): better present tutorial assignments

This commit is contained in:
Gregor Kleen 2019-10-20 12:04:46 +02:00
parent 3d3179d9fe
commit c443ee4e0d

View File

@ -316,11 +316,12 @@ derivePersistField "CorrectorState"
showCompactCorrectorLoad :: Load -> CorrectorState -> Text showCompactCorrectorLoad :: Load -> CorrectorState -> Text
showCompactCorrectorLoad load CorrectorMissing = "[" <> showCompactCorrectorLoad load CorrectorNormal <> "]" showCompactCorrectorLoad load CorrectorMissing = "[" <> showCompactCorrectorLoad load CorrectorNormal <> "]"
showCompactCorrectorLoad load CorrectorExcused = "{" <> showCompactCorrectorLoad load CorrectorNormal <> "}" showCompactCorrectorLoad load CorrectorExcused = "{" <> showCompactCorrectorLoad load CorrectorNormal <> "}"
showCompactCorrectorLoad Load{..} CorrectorNormal = proportionText <> tutorialText showCompactCorrectorLoad Load{..} CorrectorNormal | byProportion == 0 = tutorialText
| otherwise = proportionText <> " + " <> tutorialText
where where
proportionText = let propDbl :: Double proportionText = let propDbl :: Double
propDbl = fromRational byProportion propDbl = fromRational byProportion
in tshow $ roundToDigits 2 propDbl in tshow $ roundToDigits 2 propDbl
tutorialText = case byTutorial of Nothing -> mempty tutorialText = case byTutorial of Nothing -> mempty
Just True -> " (T)" Just True -> "(T)"
Just False -> " +T " Just False -> "T"