Skip to content

Commit 4d4f189

Browse files
committed
Remove nils from season_download_rollups before sorting
1 parent 26e0859 commit 4d4f189

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/models/concerns/podcast_metrics.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ def latest_season
6262

6363
def season_download_rollups
6464
published_seasons.map do |season|
65-
downloads_by_season(season_number: season).to_a.flatten
66-
end.sort { |a, b| b[1] <=> a[1] }
65+
downloads_by_season(season_number: season).to_a.flatten.presence
66+
end
67+
.compact
68+
.sort { |a, b| b[1] <=> a[1] }
6769
end
6870

6971
def season_label(season_number)

0 commit comments

Comments
 (0)