aboutsummaryrefslogtreecommitdiff
path: root/src/Notification.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Notification.hs')
-rw-r--r--src/Notification.hs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/Notification.hs b/src/Notification.hs
index 6e6677e..60062cc 100644
--- a/src/Notification.hs
+++ b/src/Notification.hs
@@ -10,30 +10,30 @@ import SendMail (sendMail)
import Time (formatCurrentLocale)
import Model.Date (getCurrentDate, getNextWeek, SuccessiveDates)
-import Model.Birthdate (Birthdate, filterBirthdayAt, filterBirthdayInside)
+import Model.Event (Event, filterBirthdayAt, filterBirthdayInside)
import Model.Mail (mailSubject, mailBody)
-import Model.Config
+import Model.Conf
-notifyTodayAndNextWeek :: [Birthdate] -> Config -> IO ()
-notifyTodayAndNextWeek birthdates config = do
+notifyTodayAndNextWeek :: [Event] -> Conf -> IO ()
+notifyTodayAndNextWeek events conf = do
currentDate <- getCurrentDate
- let birthdaysToday = filterBirthdayAt currentDate birthdates
+ let birthdaysToday = filterBirthdayAt currentDate events
nextWeek <- getNextWeek
- birthdaysNextWeek <- filterBirthdaysNextWeek config nextWeek birthdates
+ birthdaysNextWeek <- filterBirthdaysNextWeek conf nextWeek events
if length birthdaysToday > 0 || length birthdaysNextWeek > 0
then
sendMail
- (mailTo config)
- (mailFrom config)
+ (mailTo conf)
+ (mailFrom conf)
(mailSubject birthdaysToday birthdaysNextWeek)
(mailBody currentDate nextWeek birthdaysToday birthdaysNextWeek)
else
return ()
-filterBirthdaysNextWeek :: Config -> SuccessiveDates -> [Birthdate] -> IO [Birthdate]
-filterBirthdaysNextWeek config nextWeek birthdates =
+filterBirthdaysNextWeek :: Conf -> SuccessiveDates -> [Event] -> IO [Event]
+filterBirthdaysNextWeek conf nextWeek events =
(\currentDayOfWeek ->
- if T.toLower currentDayOfWeek == T.toLower (dayForNextWeekNotification config)
- then filterBirthdayInside nextWeek birthdates
+ if T.toLower currentDayOfWeek == T.toLower (dayForNextWeekNotification conf)
+ then filterBirthdayInside nextWeek events
else []
) <$> formatCurrentLocale "%A"