Compare commits
1 commit
930c039c5d
...
4308368c91
| Author | SHA1 | Date | |
|---|---|---|---|
| 4308368c91 |
1 changed files with 9 additions and 5 deletions
|
|
@ -197,7 +197,8 @@ defmodule MvWeb.MemberExportController do
|
||||||
parsed
|
parsed
|
||||||
|> ensure_sort_custom_field_loaded()
|
|> ensure_sort_custom_field_loaded()
|
||||||
|
|
||||||
with {:ok, custom_fields_by_id} <- load_custom_fields_by_id(parsed.custom_field_ids_union, actor),
|
with {:ok, custom_fields_by_id} <-
|
||||||
|
load_custom_fields_by_id(parsed.custom_field_ids_union, actor),
|
||||||
{:ok, members} <- load_members_for_export(actor, parsed, custom_fields_by_id) do
|
{:ok, members} <- load_members_for_export(actor, parsed, custom_fields_by_id) do
|
||||||
columns = build_columns(conn, parsed, custom_fields_by_id)
|
columns = build_columns(conn, parsed, custom_fields_by_id)
|
||||||
csv_iodata = MembersCSV.export(members, columns)
|
csv_iodata = MembersCSV.export(members, columns)
|
||||||
|
|
@ -215,15 +216,18 @@ defmodule MvWeb.MemberExportController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp ensure_sort_custom_field_loaded(%{custom_field_ids: ids, custom_field_ids_union: union, sort_field: sort_field} = parsed) do
|
defp ensure_sort_custom_field_loaded(
|
||||||
|
%{custom_field_ids: ids, custom_field_ids_union: union, sort_field: sort_field} = parsed
|
||||||
|
) do
|
||||||
case extract_sort_custom_field_id(sort_field) do
|
case extract_sort_custom_field_id(sort_field) do
|
||||||
nil ->
|
nil ->
|
||||||
parsed
|
parsed
|
||||||
|
|
||||||
id ->
|
id ->
|
||||||
%{parsed |
|
%{
|
||||||
custom_field_ids: Enum.uniq([id | ids]),
|
parsed
|
||||||
custom_field_ids_union: Enum.uniq([id | union])
|
| custom_field_ids: Enum.uniq([id | ids]),
|
||||||
|
custom_field_ids_union: Enum.uniq([id | union])
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue