-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptin.erl
28 lines (20 loc) · 876 Bytes
/
optin.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
%%% @doc
%%% This module tracks how many times the system has sent messages to the user and whether the have responded
%%% then based on that you query them on whether they need any keep getting the messages or they can opt out
%%% @end
-module(optin).
-export([to_minute/1, survey_encompasses_minute/2, pred/2]).
-spec to_minute(datetime_micro()) -> calendar:datetime().
-type datetime_micro() :: {{integer(), integer(), integer()}, {integer(), integer(), integer() | float()}}.
to_minute({Date, {HH, MM, _SS}})->
{Date, {HH, MM, 0}}.
survey_encompasses_minute({open, Values}, DateTime) ->
case proplists:lookup(opened, Values) of
none -> false;
{opened, OpendDT} -> to_minute(OpendDT) =< DateTime,
io:format("st_sync found unexpected value for Fields ~n")
end.
pred(X, Y) ->
SUM = X +Y,
io:format("st_sync found unexpected value for Fields ~n"),
SUM.