Account for tracks with nil length
This commit is contained in:
@@ -22,7 +22,7 @@ defmodule MusicBrainz.Release do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def medium_duration(medium) do
|
def medium_duration(medium) do
|
||||||
Enum.sum_by(medium.tracks, fn track -> track.length end)
|
Enum.sum_by(medium.tracks, fn track -> track.length || 0 end)
|
||||||
end
|
end
|
||||||
|
|
||||||
def from_api_response(r) do
|
def from_api_response(r) do
|
||||||
|
|||||||
@@ -316,7 +316,7 @@
|
|||||||
<span class="table-cell text-xs text-right pr-1">{track.position}</span>
|
<span class="table-cell text-xs text-right pr-1">{track.position}</span>
|
||||||
<span class="table-cell text-xs font-medium leading-8">{track.title}</span>
|
<span class="table-cell text-xs font-medium leading-8">{track.title}</span>
|
||||||
<span class="table-cell text-xs text-right pl-2">
|
<span class="table-cell text-xs text-right pl-2">
|
||||||
{format_duration(track.length)}
|
{track.length && format_duration(track.length)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div :if={release_with_tracks.artists !== track.artists} class="table-row text-xs">
|
<div :if={release_with_tracks.artists !== track.artists} class="table-row text-xs">
|
||||||
|
|||||||
Reference in New Issue
Block a user