Use map_join instead of map+join

This commit is contained in:
Claudio Ortolina
2025-02-18 10:14:31 +00:00
parent c25402cd4d
commit 025a5105ed
3 changed files with 3 additions and 12 deletions
@@ -9,10 +9,7 @@ defmodule MusicBrainz.ReleaseGroupSearchResult do
id: rg["id"],
type: ReleaseGroup.parse_type(rg["primary-type"]),
title: rg["title"],
artists:
rg["artist-credit"]
|> Enum.map(fn ac -> ac["artist"]["name"] end)
|> Enum.join(", "),
artists: Enum.map_join(rg["artist-credit"], ", ", fn ac -> ac["artist"]["name"] end),
release: rg["first-release-date"]
}
end
+1 -4
View File
@@ -9,10 +9,7 @@ defmodule MusicBrainz.ReleaseSearchResult do
id: r["id"],
title: r["title"],
release_group: parse_release_group(r["release-group"]),
artists:
r["artist-credit"]
|> Enum.map(fn ac -> ac["artist"]["name"] end)
|> Enum.join(", "),
artists: Enum.map_join(r["artist-credit"], ", ", fn ac -> ac["artist"]["name"] end),
date: r["date"],
barcode: r["barcode"],
media: parse_media(r["media"])
+1 -4
View File
@@ -147,10 +147,7 @@ defmodule MusicLibrary.Records do
end
def populate_genres(record) do
artists =
record.artists
|> Enum.map(fn a -> a.name end)
|> Enum.join(",")
artists = Enum.map_join(record.artists, ",", fn a -> a.name end)
completion = %OpenAI.Completion{
content: """