Skip to content

Commit

Permalink
Export attendees and entries (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiago-fontes authored Feb 23, 2021
1 parent 75cbc1a commit 73a8536
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/mix/tasks/export.attendees.entries.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
defmodule Mix.Tasks.Export.Attendees.Entries do
use Mix.Task

def run(_) do
Mix.Task.run("app.start")

Mix.shell().info("uuid,name,email,entries")

Safira.Accounts.list_active_attendees()
|> Enum.each(fn a -> csv_io(a) |> Mix.shell().info end)
end

defp csv_io(attendee) do
"#{attendee.id},#{attendee.name},#{Safira.Accounts.get_user!(attendee.user_id).email},#{
attendee.entries
}"
end
end

0 comments on commit 73a8536

Please sign in to comment.