T.string commentStart *> T.newline *>
toUtf8 (T.sliced (T.manyTill T.anyChar (T.lookAhead cend))) <* cend
_ <- T.whiteSpace
- ((sn, ExDFS $ DFS smeta sat sc ds mcs) :)
+ ((sn, ExDFS $ DFS smeta sat sc ds (maybe "" id mcs)) :)
<$> (modify (M.delete sn) >> go (M.insert sn () already))
cend = T.string commentEnd *> T.newline
module Grade.Print where
+import qualified Data.Char as C
import qualified Data.Set as S
+import qualified Data.Text as T
import Numeric
import Text.PrettyPrint.Free
p x = text $ showFFloat (Just 1) x ""
printSection :: ReportFileSection -> Doc e
-printSection (RFS st ss smax sdc msgc) =
+printSection (RFS st ss smax sdc sgc) =
pretty st <> ":" <+> printGrade ss smax <> line
`above` indent 1
(vcat (punctuate empty (map pretty sdc))
- <> maybe empty
- (\x -> (if null sdc then empty else line)
- <> "Additional Grader Comments:" <> line `above` indent 1 (pretty x))
- msgc)
+ <> (if null sdc then empty else line) <> magc sgc)
+ where
+ magc x = if T.any (not . C.isSpace) x then agc x else empty
+ agc x = "Additional Grader Comments:" <> line `above` indent 1 (pretty x)
total :: ReportFile -> (Double,Double)
total (RF secs) = foldr (\(RFS _ ss sm _ _) (e,t) -> (ss+e,sm+t)) (0.0,0.0) secs
, _dfs_sec_arg :: sat
, _dfs_loc :: loc
, _dfs_dings :: [DataFileDing sdt loc]
- , _dfs_grader_comments :: Maybe Text
+ , _dfs_grader_comments :: Text
}
deriving (Typeable)
$(LTH.makeLenses ''DataFileSection)
, _rfs_score :: Double
, _rfs_max :: Double
, _rfs_dingtext :: [Text]
- , _rfs_comments :: Maybe Text
+ , _rfs_comments :: Text
}
deriving (Show, Typeable)
$(LTH.makeLenses ''ReportFileSection)