Hi guys! I do have given map:
%RewardappWeb.User{
__meta__: #Ecto.Schema.Metadata<:loaded, "users">,
april: 50,
august: 50,
december: 50,
february: 50,
id: 1,
january: 50,
july: 50,
june: 50,
march: 50,
may: 50,
name: "mat",
november: 50,
october: 50,
points: 0,
role: "member",
september: 50,
surname: "osinski"
}
and I do have a function, which takes a current date and return a STRING as a month
def currentMonth(conn) do
date = Date.utc_today()
month = date.month
IO.inspect(month)
case month do
1 ->
month = "january"
2 ->
month = "february"
3 ->
month = "march"
4 ->
month = "april"
5 ->
month = "may"
6 ->
month = "june"
7 ->
month = "july"
8 ->
month = "august"
9 ->
month = "september"
10 ->
month = "october"
11 ->
month = "november"
12 ->
month = "december"
end
My map is stored here, in the sessionUser:
sessionUser = Plug.Conn.get_session(conn, :userInfo)
I would like to search in my map given month (from currentMonth function). I am making
currentMonth = currentMonth(conn)
and then I would like to take given month based on currentMonth from my map. How could I take that?