refactor(schedule): slightly cleanup imports, add documentation

This commit is contained in:
Sarah Vaupel 2021-05-06 14:49:58 +02:00
parent e4ba4414c6
commit 8d06a035b1
2 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@ module Utils.Schedule.Types.ScheduleOptions
import Import
import Utils.Form
import Utils.Schedule.Types.ScheduleOffset
import Utils.Schedule.Types.ScheduleView

View File

@ -16,6 +16,7 @@ import Handler.Utils.Widgets (roomReferenceWidget)
import Utils.Schedule
import Utils.Schedule.Types
import Utils.Schedule.Week.SlotAssociation
import Utils.Schedule.Week.TimeSlot
@ -180,6 +181,7 @@ weekSchedule now user@(Entity uid User{userScheduleWeekDays = ScheduleWeekDays u
-- Local helper functions
-- | Get days that are to be displayed in the week schedule
weekDays :: UTCTime -> Entity User -> ScheduleOffset -> [Day]
weekDays now (Entity _ User{userWeekStart}) scheduleOffset = go dayNowOffset
where go d
@ -253,5 +255,6 @@ dayOfWeekToDayWith weekDay = go where
| otherwise = go $ succ d
where weekDay' = dayOfWeek d
-- | Auxiliary definition to be used in templates since ranges are not parsed correctly
indexedList :: [a] -> [(Int, a)]
indexedList = zip [0..]