@@ -41,7 +41,7 @@ defmodule Mobilizon.Service.Export.Participants.CSV do
|
||||
|> Repo.stream()
|
||||
|> Stream.map(&to_list/1)
|
||||
|> NimbleCSV.RFC4180.dump_to_iodata()
|
||||
|> (fn stream -> Stream.concat([Enum.join(columns(), ","), "\n"], stream) end).()
|
||||
|> add_header_column()
|
||||
|> Stream.each(fn line -> IO.write(file, line) end)
|
||||
|> Stream.run()
|
||||
|
||||
@@ -63,6 +63,10 @@ defmodule Mobilizon.Service.Export.Participants.CSV do
|
||||
end
|
||||
end
|
||||
|
||||
defp add_header_column(stream) do
|
||||
Stream.concat([Enum.join(columns(), ","), "\n"], stream)
|
||||
end
|
||||
|
||||
@spec save_csv_upload(String.t(), String.t(), Event.t()) ::
|
||||
{:ok, Export.t()} | {:error, atom() | Ecto.Changeset.t()}
|
||||
defp save_csv_upload(full_path, filename, %Event{id: event_id, title: title}) do
|
||||
|
||||
Reference in New Issue
Block a user