Skip to content

Commit 60b4471

Browse files
committed
Trim entries and ignore blank labels
1 parent 2bc25b7 commit 60b4471

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: app/lib/nul/authority_records.ex

+6-3
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,16 @@ defmodule NUL.AuthorityRecords do
9999
inserted_at = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
100100

101101
records =
102-
Enum.map(list_of_attrs, fn attrs ->
103-
Map.merge(attrs, %{
102+
Enum.map(list_of_attrs, fn entry ->
103+
%{
104104
id: "info:nul/" <> Ecto.UUID.generate(),
105+
label: String.trim(Map.get(entry, :label, "")),
106+
hint: String.trim(Map.get(entry, :hint, "")),
105107
inserted_at: inserted_at,
106108
updated_at: inserted_at
107-
})
109+
}
108110
end)
111+
|> Enum.reject(&(&1.label == ""))
109112

110113
labels = Enum.map(records, & &1.label)
111114

0 commit comments

Comments
 (0)