refactor(schedule-week): remove deprecated week messages
This commit is contained in:
parent
db49943baf
commit
428b8cf739
@ -112,22 +112,6 @@ ScheduleTime: Zeit
|
||||
ScheduleOccur: Findet statt
|
||||
ScheduleNoOccur: Findet nicht statt
|
||||
|
||||
ScheduleWeekDayMonday: Montag
|
||||
ScheduleWeekDayTuesday: Dienstag
|
||||
ScheduleWeekDayWednesday: Mittwoch
|
||||
ScheduleWeekDayThursday: Donnerstag
|
||||
ScheduleWeekDayFriday: Freitag
|
||||
ScheduleWeekDaySaturday: Samstag
|
||||
ScheduleWeekDaySunday: Sonntag
|
||||
|
||||
ScheduleWeekDayMondayShort: Mo
|
||||
ScheduleWeekDayTuesdayShort: Di
|
||||
ScheduleWeekDayWednesdayShort: Mi
|
||||
ScheduleWeekDayThursdayShort: Do
|
||||
ScheduleWeekDayFridayShort: Fr
|
||||
ScheduleWeekDaySaturdayShort: Sa
|
||||
ScheduleWeekDaySundayShort: So
|
||||
|
||||
|
||||
SchoolListHeading: Übersicht über verwaltete Institute
|
||||
SchoolHeading school@SchoolName: Übersicht #{school}
|
||||
|
||||
@ -112,22 +112,6 @@ ScheduleTime: Time
|
||||
ScheduleOccur: Does occur
|
||||
ScheduleNoOccur: Does not occur
|
||||
|
||||
ScheduleWeekDayMonday: Monday
|
||||
ScheduleWeekDayTuesday: Tuesday
|
||||
ScheduleWeekDayWednesday: Wednesday
|
||||
ScheduleWeekDayThursday: Thursday
|
||||
ScheduleWeekDayFriday: Friday
|
||||
ScheduleWeekDaySaturday: Saturday
|
||||
ScheduleWeekDaySunday: Sunday
|
||||
|
||||
ScheduleWeekDayMondayShort: Mon
|
||||
ScheduleWeekDayTuesdayShort: Tue
|
||||
ScheduleWeekDayWednesdayShort: Wed
|
||||
ScheduleWeekDayThursdayShort: Thu
|
||||
ScheduleWeekDayFridayShort: Fri
|
||||
ScheduleWeekDaySaturdayShort: Sat
|
||||
ScheduleWeekDaySundayShort: Sun
|
||||
|
||||
|
||||
SchoolListHeading: Department
|
||||
SchoolHeading school: #{school}
|
||||
|
||||
@ -20,10 +20,9 @@ import Utils.Schedule.Types
|
||||
import Utils.Schedule.Week.TimeSlot
|
||||
|
||||
|
||||
-- TODO: implement weekOffset
|
||||
-- TODO: use more general dayOffset instead of weekOffset
|
||||
weekSchedule :: UserId -> Maybe Int -> Widget
|
||||
weekSchedule uid _weekOffset = do
|
||||
-- TODO: implement dayOffset
|
||||
weekSchedule :: UserId -> Maybe Integer -> Widget
|
||||
weekSchedule uid _dayOffset = do
|
||||
now <- liftIO getCurrentTime
|
||||
tz <- liftIO getCurrentTimeZone
|
||||
ata <- getSessionActiveAuthTags
|
||||
@ -132,7 +131,7 @@ weekSchedule uid _weekOffset = do
|
||||
&& seeoStart < nextSlotUTCTime
|
||||
|
||||
events' :: Map Day (Map TimeSlot [ScheduleEntry])
|
||||
events' = Map.fromList $ currentWeek <&> \day ->
|
||||
events' = Map.fromList $ week <&> \day ->
|
||||
( day
|
||||
, Map.fromList $ slotsToDisplay <&> \slot ->
|
||||
( slot
|
||||
@ -164,26 +163,13 @@ weekSchedule uid _weekOffset = do
|
||||
_ -> True -- TODO: maybe filter out ExceptNoOccurs? (Should NoOccurs be displayed or not?)
|
||||
in filter isRegularWithoutException occurrencesInSlot
|
||||
|
||||
-- TODO: Internationalize week start (and/or make configurable)
|
||||
-- TODO: Internationalize default week start (and/or make configurable)
|
||||
-- TODO: auto-hide saturday and sunday (if there are no events scheduled)?
|
||||
-- TODO: weekday messages deprecated / not used => remove
|
||||
|
||||
currentWeek :: [Day]
|
||||
currentWeek = currentWeekAux $ utctDay now
|
||||
where currentWeekAux day
|
||||
week :: [Day]
|
||||
week = go $ utctDay now
|
||||
where go day
|
||||
| Monday <- dayOfWeek day = [day .. toEnum (fromEnum day + 6)]
|
||||
| otherwise = currentWeekAux $ pred day
|
||||
|
||||
weekDays :: [(Day, UniWorXMessage, Text)]
|
||||
weekDays = zipWith (\x (y,z) -> (x,y,z)) currentWeek
|
||||
[ (MsgScheduleWeekDayMonday , "mon")
|
||||
, (MsgScheduleWeekDayTuesday , "tue")
|
||||
, (MsgScheduleWeekDayWednesday , "wed")
|
||||
, (MsgScheduleWeekDayThursday , "thu")
|
||||
, (MsgScheduleWeekDayFriday , "fri")
|
||||
, (MsgScheduleWeekDaySaturday , "sat")
|
||||
, (MsgScheduleWeekDaySunday , "sun")
|
||||
]
|
||||
| otherwise = go $ pred day
|
||||
|
||||
$(widgetFile "widgets/schedule/week")
|
||||
|
||||
@ -205,6 +191,11 @@ formatOccurrenceW = \case
|
||||
Right (Left ExceptNoOccur{}) -> [whamlet| _{MsgScheduleNoOccur} |] -- <> formatTimeW SelFormatDateTime exceptTime
|
||||
Left ScheduleEntryExamOccurrence{..} -> [whamlet| _{MsgScheduleOccur}: |] <> formatTimeRangeW SelFormatTime seeoStart seeoEnd
|
||||
|
||||
-- | Uniquely identify each day as table head
|
||||
-- | This avoids constantly hiding e.g. some DayOfWeek (which would interfere with day offsets)
|
||||
dayTableHeadIdent :: Day -> Text
|
||||
dayTableHeadIdent = tshow . toModifiedJulianDay
|
||||
|
||||
-- | Convert from DayOfWeek to Day of this week using the current time (as UTCTime)
|
||||
dayOfWeekToDayWith :: DayOfWeek -> UTCTime -> Day
|
||||
dayOfWeekToDayWith weekDay = go . utctDay where
|
||||
|
||||
@ -5,15 +5,15 @@ $newline never
|
||||
<tr .table__row .table__row--head>
|
||||
<th .table__th uw-hide-column-header="time">
|
||||
_{MsgScheduleTableHeadTime}
|
||||
$forall (day, _, weekDayIdent) <- weekDays
|
||||
<th .table__th uw-hide-column-header=#{weekDayIdent}>
|
||||
$forall day <- week
|
||||
<th .table__th uw-hide-column-header=#{dayTableHeadIdent day}>
|
||||
^{formatTimeW SelFormatDate day}
|
||||
<tbody>
|
||||
$forall slot <- slotsToDisplay
|
||||
<tr .table__row>
|
||||
<td .table__td>
|
||||
^{formatTimeSlotW slot}
|
||||
$forall (day, _, _) <- weekDays
|
||||
$forall day <- week
|
||||
<td .table__td>
|
||||
<div .table__td-content>
|
||||
$maybe dayEvents <- Map.lookup day events
|
||||
|
||||
Reference in New Issue
Block a user