attempt at #374 failed

This commit is contained in:
Steffen Jost 2019-05-16 13:58:07 +02:00
parent 953f7af122
commit 86204f78e2

View File

@ -200,6 +200,35 @@ colCommentField = sortable (Just "comment") (i18nCell MsgRatingComment) $ formCe
(\DBRow{ dbrOutput=(Entity subId _, _, _, _, _) } -> return subId)
(\DBRow{ dbrOutput=(Entity _ Submission{..}, _, _, _, _) } mkUnique -> over (_1.mapped) ((_3 .~) . assertM (not . null) . fmap (Text.strip . unTextarea)) . over _2 fvInput <$> mopt textareaField (fsUniq mkUnique "comment") (Just $ Textarea <$> submissionRatingComment))
colLastEdit :: Colonnade Sortable CorrectionTableData (DBCell _ (FormResult (DBFormResult SubmissionId (a, b, Maybe Text) CorrectionTableData)))
colLastEdit = sortable (Just "last-edit") (i18nCell MsgLastEdit) $
\DBRow{ dbrOutput=(Entity subId _, _, _, _, _) } -> sqlCell $ do
edits <- E.select $ E.from $ \edit -> do
E.where_ $ edit E.^. SubmissionEditSubmission E.==. E.val subId
return $ E.max_ $ edit E.^. SubmissionEditTime
return [whamlet|
$newline never
DATES
$forall ed <- edits
#{show ed}
|]
-- colLastEdit' :: Colonnade Sortable CorrectionTableData (DBCell _ (FormResult (DBFormResult SubmissionId (a, b, Maybe Text) CorrectionTableData)))
-- colLastEdit' = sortable (Just "last-edit") (i18nCell MsgLastEdit) $ (formCell id
-- (\DBRow{ dbrOutput=(Entity subId _, _, _, _, _) } -> return subId)
-- (const mempty))
-- -- \DBRow{ dbrOutput=(Entity subId _, _, _, _, _) } -> sqlCell $ do
-- -- edits <- E.select $ E.from $ \edit -> do
-- -- E.where_ $ edit E.^. SubmissionEditSubmission E.==. E.val subId
-- -- return $ E.max_ $ edit E.^. SubmissionEditTime
-- -- return [whamlet|
-- -- $newline never
-- -- DATES
-- -- $forall ed <- edits
-- -- #{show ed}
-- -- |]
makeCorrectionsTable :: ( IsDBTable m x, ToSortable h, Functor h )
=> CorrectionTableWhere -> Colonnade h CorrectionTableData (DBCell m x) -> _ -> PSValidator m x -> _ -> DBParams m x -> DB (DBResult m x)
@ -551,6 +580,8 @@ postCCorrectionsR tid ssh csh = do
, colSMatrikel
, colSubmittors
, colSubmissionLink
-- , colLastEdit -- this does not type
-- , colLastEdit'
, colRating
, colRated
, colCorrector