Guest User

Untitled

a guest
Jul 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. {ok, RawCDs} = core_cds:find_all(),
  2.  
  3. FilteredCDs = lists:filter(fun(CD) ->
  4. Now = date(),
  5. case ecdm_cd:maturity_date(CD) of
  6. undefined ->
  7. true;
  8. Value when Value < Now ->
  9. true;
  10. _ ->
  11. false
  12. end
  13. end,
  14. RawCDs),
  15. CDs = lists:map(fun(CD) ->
  16. IssuerKey = ecdm_cd:issuer(CD),
  17. IssuerKey = ecdm_cd:buyer(CD),
  18. {ok, Issuer} = ecdm_accounts:find(IssuerKey),
  19. AccountNum = ecdm_account:account_num(Issuer),
  20. IssuerName = ecdm_account:account_desc(Issuer),
  21. IssuerFDIC = ecdm_issuer_account:fdic(Issuer),
  22. Funded = case ecdm_cd:state(CD) of
  23. opened_and_funded ->
  24. "true";
  25. _ ->
  26. "false"
  27. end,
  28. {OYear, OMonth, ODay} = ecdm_cd:open_by_date(CD),
  29. OpenDate = io_lib:format("~2..0B/~2..0B/~4..0B",
  30. [OMonth, ODay, OYear]),
  31. {MYear, MMonth, MDay} = ecdm_cd:maturity_date(CD),
  32. MaturityDate = io_lib:format("~2..0B/~2..0B/~4..0B",
  33. [MMonth, MDay, MYear]),
  34. {cd, [{key, ecdm_cd:key(CD)},
  35. {ergonomic_id, ecdm_cd:ergonomic_id(CD)},
  36. {size, ecdm_cd:size(CD)},
  37. {apy, ecdm_cd:apy(CD)},
  38. {bank_cd_number, ecdm_cd:bank_cd_number(CD)},
  39. {open_date, OpenDate},
  40. {funded, Funded},
  41. {maturity_date, MaturityDate},
  42. {issuer_fdic, IssuerFDIC},
  43. {issuer_name, IssuerName},
  44. {account_num, AccountNum}]}
  45. end, FilteredCDs).
Add Comment
Please, Sign In to add comment