NO COMPILE. Templates for summaries done, but nestes does not (still) work. Duh.

This commit is contained in:
SJost 2018-11-30 14:44:23 +01:00
parent 2308771350
commit 81d8d8c017
2 changed files with 38 additions and 36 deletions

View File

@ -365,7 +365,7 @@ correctionsR whereClause (formColonnade -> displayColumns) psValidator actions =
points <- E.select . E.from $ correctionsTableQuery whereClause getTypePoints
-- points <- E.select . E.from $ t@((course `E.InnerJoin` sheet `E.InnerJoin` submission) `E.LeftOuterJoin` corrector) -> (correctionsTableQuery whereClause getTypePoints t) <* E.distinctOn []
return $ foldMap (\(E.Value stype, E.Value srpoints, E.Value srtime) -> sheetTypeSum stype (srpoints <* srtime)) points
let statistics = $(widgetFile "widgets/gradingSummary")
let statistics = gradeSummaryWidget gradingSummary
fmap toTypedContent . defaultLayout $ do
setTitleI MsgCourseCorrectionsTitle
$(widgetFile "corrections")
@ -384,8 +384,18 @@ correctionsR whereClause (formColonnade -> displayColumns) psValidator actions =
(== Authorized) <$> evalAccessDB route True
gradeSummaryWidget :: SheetTypeSummary -> Widget UniWorX IO ()
gradeSummaryWidget sts = undefined
gradeSummaryWidget sts =
let SheetTypeSummary{..} = addBonusToPoints sts
sumSummaries = (normalSummary <> bonusSummary <> informationalSummary) # _numSheets %~ (<> numNotGraded)
hasPassings = positiveSum $ numGradePasses sumSummaries
hasPoints = positiveSum $ sumGradePoints sumSummaries
rowWdgts = [ $(widgetFile "widgets/gradingSummaryRow")
| (sumHeader,summary) <-
[ (MsgSheetTypeNormal' ,normalSummary)
, (MsgSheetTypeBonus' ,bonusSummary)
, (MsgSheetTypeInformational' ,informationalSummary)
] ]
in $(widgetFile "widgets/gradingSummary")
type ActionCorrections' = (ActionCorrections, AForm (HandlerT UniWorX IO) ActionCorrectionsData)

View File

@ -1,35 +1,27 @@
$# Displays gradings Summary for various purposes
$# --
$with SheetTypeSummary{..} <- addBonusToPoints gradingSummary
$with sumSummaries <- mappend normalSummary (mappend bonusSummary informationalSummary)
$with hasPassings <- positiveSum $ numGradePasses sumSummaries
$with hasPoints <- positiveSum $ sumGradePoints sumSummaries
<div>
<table>
<tr>
<th>
$# empty cell for row headers
$maybe _ <- hasPassings
<th colspan=2>_{MsgSheetGradingPassing'}
$maybe _ <- hasPoints
<th colspan=2>_{MsgSheetGradingPoints'}
<th>_{MsgSheetGradingCount'}
$# Number of Sheet/Submissions used for calculating maximum passes/points
$with sumHeader <- MsgSheetTypeNormal'
$with summary <- normalSummary
^{gradingSummaryRow}
$# $for (sumHeader, summary) <- [(MsgSheetTypeNormal',normalSummary),(MsgSheetTypeBonus',bonusSummary),(MsgSheetTypeInformational',informationalSummary)]
$# ^{gradingSummaryRow}
DEBUG
$maybe nrNoGrade <- positiveSum $ numNotGraded
<tr>
<th>_{MsgSheetTypeNotGraded}
$maybe _ <- hasPassings
<td colspan=2>
$maybe _ <- hasPoints
<td colspan=2>
<td>#{display nrNoGrade}
$maybe _ <- positiveSum $ bonusSummary ^. _numSheets
<p>_{MsgSheetTypeInfo}
$nothing
<p>_{MsgSheetTypeInfo}
<div>
<table>
<tr>
<th>
$# empty cell for row headers
$maybe _ <- hasPassings
<th colspan=2>_{MsgSheetGradingPassing'}
$maybe _ <- hasPoints
<th colspan=2>_{MsgSheetGradingPoints'}
<th>_{MsgSheetGradingCount'}
$# Number of Sheet/Submissions used for calculating maximum passes/points
$forall row <- rowWdgts
^{row}
$maybe nrNoGrade <- positiveSum $ numNotGraded
<tr>
<th>_{MsgSheetTypeNotGraded}
$maybe _ <- hasPassings
<td colspan=2>
$maybe _ <- hasPoints
<td colspan=2>
<td>#{display nrNoGrade}
$maybe _ <- positiveSum $ bonusSummary ^. _numSheets
<p>_{MsgSheetTypeInfo}
$nothing
<p>_{MsgSheetTypeInfo}