forked from potsda.mn/mobilizon
Allow is_delay_ok_since_last_notification_sent? to have the delay as
param Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
44b2ca26bd
commit
3fea2d0395
|
@ -205,9 +205,12 @@ defmodule Mobilizon.Service.DateTime do
|
||||||
is_first_day_of_week(compare_to_day, locale) && is_between_hours?(options)
|
is_first_day_of_week(compare_to_day, locale) && is_between_hours?(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec is_delay_ok_since_last_notification_sent?(DateTime.t()) :: boolean()
|
@spec is_delay_ok_since_last_notification_sent?(DateTime.t(), pos_integer()) :: boolean()
|
||||||
def is_delay_ok_since_last_notification_sent?(%DateTime{} = last_notification_sent) do
|
def is_delay_ok_since_last_notification_sent?(
|
||||||
DateTime.compare(DateTime.add(last_notification_sent, 3_600), DateTime.utc_now()) ==
|
%DateTime{} = last_notification_sent,
|
||||||
|
delay \\ 3_600
|
||||||
|
) do
|
||||||
|
DateTime.compare(DateTime.add(last_notification_sent, delay), DateTime.utc_now()) ==
|
||||||
:lt
|
:lt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue