Bugfix exercise sheet summaries

This commit is contained in:
SJost 2019-01-26 14:20:43 +01:00
parent 85bdf8766b
commit f8c13bf7bd
2 changed files with 12 additions and 7 deletions

View File

@ -218,15 +218,17 @@ getSheetListR tid ssh csh = do
return $ CSubmissionR tid ssh csh sheetName cid' SubShowR return $ CSubmissionR tid ssh csh sheetName cid' SubShowR
in anchorCellM mkRoute (mkCid >>= \cid2 -> [whamlet|#{display cid2}|]) in anchorCellM mkRoute (mkCid >>= \cid2 -> [whamlet|#{display cid2}|])
, sortable (Just "rating") (i18nCell MsgRating) , sortable (Just "rating") (i18nCell MsgRating)
$ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, mbSub)} -> case mbSub of $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, mbSub)} ->
Nothing -> mempty let stats = sheetTypeSum sheetType in -- for statistics over all shown rows
case mbSub of
Nothing -> cellTell mempty $ stats Nothing
(Just (Entity sid Submission{..})) -> (Just (Entity sid Submission{..})) ->
let stats = sheetTypeSum sheetType submissionRatingPoints -- for statistics over all shown rows let mkCid = encrypt sid
mkCid = encrypt sid
mkRoute = do mkRoute = do
cid' <- mkCid cid' <- mkCid
return $ CSubmissionR tid ssh csh sheetName cid' CorrectionR return $ CSubmissionR tid ssh csh sheetName cid' CorrectionR
in cellTell stats $ anchorCellM mkRoute $(widgetFile "widgets/rating") acell = anchorCellM mkRoute $(widgetFile "widgets/rating")
in cellTell acell $ stats submissionRatingPoints
, sortable Nothing -- (Just "percent") , sortable Nothing -- (Just "percent")
(i18nCell MsgRatingPercent) (i18nCell MsgRatingPercent)

View File

@ -15,8 +15,11 @@ type CourseLink = (TermId, SchoolId, CourseShorthand) -- TODO: Refactor with Wit
-------------------- --------------------
-- Special cells -- Special cells
cellTell :: (Monoid a, IsDBTable m a) => a -> DBCell m a -> DBCell m a tellCell :: (Monoid a, IsDBTable m a) => a -> DBCell m a -> DBCell m a
cellTell = flip mappend . writerCell . tell tellCell = flip mappend . writerCell . tell
cellTell :: (Monoid a, IsDBTable m a) => DBCell m a -> a -> DBCell m a
cellTell = flip tellCell
indicatorCell :: IsDBTable m Any => DBCell m Any -- For dbTables that return a Bool to indicate content indicatorCell :: IsDBTable m Any => DBCell m Any -- For dbTables that return a Bool to indicate content
indicatorCell = writerCell . tell $ Any True indicatorCell = writerCell . tell $ Any True