|
@ -39,25 +39,36 @@ getEdt conf@Config {..} opts = do |
|
|
(HTTP.getResponseBody cal_req) |
|
|
(HTTP.getResponseBody cal_req) |
|
|
dates <- readDate date |
|
|
dates <- readDate date |
|
|
tz <- DT.getTimeZone $ DT.UTCTime (head dates) $ DT.secondsToDiffTime 43200 |
|
|
tz <- DT.getTimeZone $ DT.UTCTime (head dates) $ DT.secondsToDiffTime 43200 |
|
|
let message = case cal of |
|
|
|
|
|
Left _ -> "I don't know this group, alternatively ADE doesn't work" |
|
|
|
|
|
Right (vcal@IT.VCalendar { IT.vcEvents = evm } : _, _) -> |
|
|
|
|
|
TS.unlines |
|
|
|
|
|
. map |
|
|
|
|
|
(\d -> if not (null (ev d)) |
|
|
|
|
|
then |
|
|
|
|
|
"**" |
|
|
|
|
|
`TS.append` TS.pack (show d) |
|
|
|
|
|
`TS.append` "**\n" |
|
|
|
|
|
`TS.append` renderEvents tz (ev d) |
|
|
|
|
|
else "No classes for the selected dates" |
|
|
|
|
|
) |
|
|
|
|
|
$ dates |
|
|
|
|
|
where |
|
|
|
|
|
ev :: DT.Day -> [IT.VEvent] |
|
|
|
|
|
ev d = |
|
|
|
|
|
sortOn IT.veDTStart . filter (inDate d) . map snd . Map.toList $ evm |
|
|
|
|
|
_ -> "An unexpected error has occured" |
|
|
|
|
|
|
|
|
let |
|
|
|
|
|
message = |
|
|
|
|
|
case |
|
|
|
|
|
(case cal of |
|
|
|
|
|
Left _ -> "I don't know this group, alternatively ADE doesn't work" |
|
|
|
|
|
Right (vcal@IT.VCalendar { IT.vcEvents = evm } : _, _) -> |
|
|
|
|
|
TS.unlines |
|
|
|
|
|
. map |
|
|
|
|
|
(\d -> if not (null (ev d)) |
|
|
|
|
|
then |
|
|
|
|
|
"**" |
|
|
|
|
|
`TS.append` TS.pack (show d) |
|
|
|
|
|
`TS.append` "**\n" |
|
|
|
|
|
`TS.append` renderEvents tz (ev d) |
|
|
|
|
|
else "" |
|
|
|
|
|
) |
|
|
|
|
|
$ dates |
|
|
|
|
|
where |
|
|
|
|
|
ev :: DT.Day -> [IT.VEvent] |
|
|
|
|
|
ev d = |
|
|
|
|
|
sortOn IT.veDTStart |
|
|
|
|
|
. filter (inDate d) |
|
|
|
|
|
. map snd |
|
|
|
|
|
. Map.toList |
|
|
|
|
|
$ evm |
|
|
|
|
|
_ -> "An unexpected error has occured" |
|
|
|
|
|
) |
|
|
|
|
|
of |
|
|
|
|
|
"" -> "No classes for the selected period" |
|
|
|
|
|
s -> s |
|
|
return message |
|
|
return message |
|
|
where |
|
|
where |
|
|
group :: TS.Text |
|
|
group :: TS.Text |
|
|