Skip to content

Commit

Permalink
mix format
Browse files Browse the repository at this point in the history
  • Loading branch information
katafrakt committed Sep 21, 2023
1 parent 659fdc1 commit 2dafd8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/keila_web/controllers/contact_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,13 @@ defmodule KeilaWeb.ContactController do
|> NimbleCSV.RFC4180.dump_to_iodata()
|> IO.iodata_to_binary()

{:ok,conn} = chunk(conn, header)
{:ok, conn} = chunk(conn, header)

Keila.Repo.transaction(fn ->
Contacts.stream_project_contacts(project_id, max_rows: @csv_export_chunk_size)
|> Stream.map(fn contact ->
data = if is_nil(contact.data), do: nil, else: Jason.encode!(contact.data)

[[contact.email, contact.first_name, contact.last_name, data, contact.status]]
|> NimbleCSV.RFC4180.dump_to_iodata()
|> IO.iodata_to_binary()
Expand Down
7 changes: 6 additions & 1 deletion lib/keila_web/templates/segment/edit_live.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@
</div>
</div>
<div>
<a href={Routes.segment_path(@socket, :contacts_export, @current_project.id, @segment.id)} class="button">
<a
href={
Routes.segment_path(@socket, :contacts_export, @current_project.id, @segment.id)
}
class="button"
>
<%= render_icon(:download) %>
<%= gettext("Export contacts to CSV") %>
</a>
Expand Down

0 comments on commit 2dafd8b

Please sign in to comment.