diff --git a/src/Handler/Corrections.hs b/src/Handler/Corrections.hs index 29f31b107..2421a1b6a 100644 --- a/src/Handler/Corrections.hs +++ b/src/Handler/Corrections.hs @@ -172,11 +172,11 @@ colRating = sortable (Just "rating") (i18nCell MsgRating) $ \DBRow{ dbrOutput=(E colAssigned :: IsDBTable m a => Colonnade _ CorrectionTableData (DBCell m a) colAssigned = sortable (Just "assignedtime") (i18nCell MsgAssignedTime) $ \DBRow{ dbrOutput=(Entity _subId Submission{..}, _sheet, _course, _, _) } -> - maybe mempty timeCell submissionRatingAssigned + maybe mempty dateTimeCell submissionRatingAssigned colRated :: IsDBTable m a => Colonnade _ CorrectionTableData (DBCell m a) colRated = sortable (Just "ratingtime") (i18nCell MsgRatingTime) $ \DBRow{ dbrOutput=(Entity _subId Submission{..}, _sheet, _course, _, _) } -> - maybe mempty timeCell submissionRatingTime + maybe mempty dateTimeCell submissionRatingTime colPseudonyms :: IsDBTable m a => Colonnade _ CorrectionTableData (DBCell m a) colPseudonyms = sortable Nothing (i18nCell MsgPseudonyms) $ \DBRow{ dbrOutput=(_, _, _, _, users) } -> let diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 91f379b96..1851e4f28 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -83,13 +83,13 @@ colSchoolShort = sortable (Just "schoolshort") (i18nCell MsgCourseSchoolShort) colRegFrom :: IsDBTable m a => Colonnade _ CourseTableData (DBCell m a) colRegFrom = sortable (Just "register-from") (i18nCell MsgRegisterFrom) $ \DBRow{ dbrOutput=(Entity _ Course{..}, _, _, _) } -> - maybe mempty timeCell courseRegisterFrom + maybe mempty dateTimeCell courseRegisterFrom -- cell $ traverse (formatTime SelFormatDateTime) courseRegisterFrom >>= maybe mempty toWidget colRegTo :: IsDBTable m a => Colonnade _ CourseTableData (DBCell m a) colRegTo = sortable (Just "register-to") (i18nCell MsgRegisterTo) $ \DBRow{ dbrOutput=(Entity _ Course{..}, _, _, _) } -> - maybe mempty timeCell courseRegisterTo + maybe mempty dateTimeCell courseRegisterTo colMembers :: IsDBTable m a => Colonnade _ CourseTableData (DBCell m a) colMembers = sortable (Just "members") (i18nCell MsgCourseMembers) @@ -705,7 +705,7 @@ getCUsersR tid ssh csh = do [ colUserParticipantLink tid ssh csh , colUserEmail , colUserMatriclenr - , sortable (Just "registration") (i18nCell MsgRegistered) (timeCell . (view _userTableRegistration)) + , sortable (Just "registration") (i18nCell MsgRegistered) (dateCell . (view _userTableRegistration)) , colUserComment tid ssh csh ] psValidator = def diff --git a/src/Handler/Profile.hs b/src/Handler/Profile.hs index 6b5a7e237..a57e1149c 100644 --- a/src/Handler/Profile.hs +++ b/src/Handler/Profile.hs @@ -336,7 +336,7 @@ mkEnrolledCoursesTable = courseCell <$> view (_dbrOutput . _1 . _entityVal) , sortable (Just "time") (i18nCell MsgRegistered) $ do regTime <- view $ _dbrOutput . _2 - return $ timeCell regTime + return $ dateTimeCell regTime ] , dbtSorting = Map.fromList [ ( "course", SortColumn $ withType $ \(crse `E.InnerJoin` _) -> crse E.^. CourseName ) @@ -409,9 +409,9 @@ mkSubmissionTable = <*> view (_3 . _entityKey) -- , sortable (Just "edit") (i18nCell MsgSubmissionEditUser) $ do -- regTime <- view $ _dbrOutput . _4 --- return $ maybe mempty timeCell regTime +-- return $ maybe mempty dateTimeCell regTime , sortable (Just "edit") (i18nCell MsgLastEditByUser) $ - maybe mempty timeCell <$> view (_dbrOutput . _4) + maybe mempty dateTimeCell <$> view (_dbrOutput . _4) ] validator = def -- DUPLICATED CODE: Handler.Corrections @@ -483,7 +483,7 @@ mkSubmissionGroupTable = , sortable (Just "submissiongroup") (i18nCell MsgSubmissionGroupName) . magnify (_dbrOutput . _2 . _entityVal) $ maybe mempty textCell <$> view _submissionGroupName , sortable (Just "edit") (i18nCell MsgLastEdit) $ - maybe mempty timeCell <$> view (_dbrOutput . _3) + maybe mempty dateTimeCell <$> view (_dbrOutput . _3) ] validator = def -- DUPLICATED CODE: Handler.Corrections diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index ebd365521..f6e4fe51c 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -177,13 +177,13 @@ getSheetListR tid ssh csh = do , sortable (Just "name") (i18nCell MsgSheet) $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _)} -> anchorCell (CSheetR tid ssh csh sheetName SShowR) (toWidget sheetName) , sortable (Just "last-edit") (i18nCell MsgLastEdit) - $ \DBRow{dbrOutput=(_, E.Value mEditTime, _)} -> maybe mempty timeCell mEditTime + $ \DBRow{dbrOutput=(_, E.Value mEditTime, _)} -> maybe mempty dateTimeCell mEditTime , sortable (Just "visible-from") (i18nCell MsgSheetVisibleFrom) - $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _)} -> maybe mempty timeCell sheetVisibleFrom + $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _)} -> maybe mempty dateTimeCell sheetVisibleFrom , sortable (Just "submission-since") (i18nCell MsgSheetActiveFrom) - $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _)} -> timeCell sheetActiveFrom + $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _)} -> dateTimeCell sheetActiveFrom , sortable (Just "submission-until") (i18nCell MsgSheetActiveTo) - $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _)} -> timeCell sheetActiveTo + $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _)} -> dateTimeCell sheetActiveTo , sortable Nothing (i18nCell MsgSheetType) $ \DBRow{dbrOutput=(Entity _ Sheet{..}, _, _)} -> i18nCell sheetType , sortable Nothing (i18nCell MsgSubmission) diff --git a/src/Handler/Submission.hs b/src/Handler/Submission.hs index d3d624d86..feb44cb9b 100644 --- a/src/Handler/Submission.hs +++ b/src/Handler/Submission.hs @@ -280,7 +280,7 @@ submissionHelper tid ssh csh shn (SubmissionMode mcid) = do origTime = fileModified . entityVal . snd <$> mOrig corrTime = fileModified . entityVal . snd <$> mCorr Just fileTime = (max <$> origTime <*> corrTime) <|> origTime <|> corrTime - in timeCell fileTime + in dateTimeCell fileTime ] coalesce :: ((Maybe (Entity SubmissionFile), Maybe (Entity File)), (Maybe (Entity SubmissionFile), Maybe (Entity File))) -> (Maybe (Entity SubmissionFile, Entity File), Maybe (Entity SubmissionFile, Entity File)) coalesce ((ma, mb), (mc, md)) = ((,) <$> ma <*> mb, (,) <$> mc <*> md) diff --git a/src/Handler/Utils/Table/Cells.hs b/src/Handler/Utils/Table/Cells.hs index 1ae5abadf..68bd0e9a3 100644 --- a/src/Handler/Utils/Table/Cells.hs +++ b/src/Handler/Utils/Table/Cells.hs @@ -53,7 +53,13 @@ commentCell (Just link) = anchorCell link icon ----------------- -- Datatype cells timeCell :: IsDBTable m a => UTCTime -> DBCell m a -timeCell t = cell $ formatTime SelFormatDateTime t >>= toWidget +timeCell t = cell $ formatTime SelFormatTime t >>= toWidget + +dateCell :: IsDBTable m a => UTCTime -> DBCell m a +dateCell t = cell $ formatTime SelFormatDate t >>= toWidget + +dateTimeCell :: IsDBTable m a => UTCTime -> DBCell m a +dateTimeCell t = cell $ formatTime SelFormatDateTime t >>= toWidget userCell :: IsDBTable m a => Text -> Text -> DBCell m a userCell displayName surname = cell $ nameWidget displayName surname @@ -84,8 +90,8 @@ cellHasEMail = emailCell . view _userEmail -- Just for documentation purposes; inline this code instead: -maybeTimeCell :: IsDBTable m a => Maybe UTCTime -> DBCell m a -maybeTimeCell = maybe mempty timeCell +maybeDateTimeCell :: IsDBTable m a => Maybe UTCTime -> DBCell m a +maybeDateTimeCell = maybe mempty dateTimeCell numCell :: (IsDBTable m a, Num b, DisplayAble b) => b -> DBCell m a numCell = textCell . display