Skip to content

Commit

Permalink
Fix pretty-printing multiple feedback judgements
Browse files Browse the repository at this point in the history
Addresses question 1 in #28
  • Loading branch information
oleks committed Apr 10, 2020
1 parent 18a18ec commit 148ca6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Export/Feedback.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import Prelude hiding ((<>))
import Text.PrettyPrint

feedbackRemarks :: [Judgement] -> String
feedbackRemarks = render . hcat . map (formatJudgement 1)
feedbackRemarks = render . vcat . map (formatJudgement 1)

formatJudgement :: Int -> Judgement -> Doc
formatJudgement _ (Feedback (_, t)) = text t
formatJudgement _ (Bonus (_, _, _)) = empty
formatJudgement depth (j @ (Judgement (_, _, _, judgements))) =
case isEmpty subj of
True -> empty
False -> formatHeader depth j $+$ text "" $+$ subj
False -> formatHeader depth j $+$ text "" $+$ subj $+$ text ""
where
subj = vcat $ map (formatJudgement (depth + 1)) judgements

Expand Down

0 comments on commit 148ca6b

Please sign in to comment.