diff --git a/app/models/album.rb b/app/models/album.rb
index e8ebbc5..2a8aa35 100644
--- a/app/models/album.rb
+++ b/app/models/album.rb
@@ -32,7 +32,7 @@ class Album < ApplicationRecord
scope :pending, -> { where(publication_status: :pending) }
scope :in_release_order, -> { order(Arel.sql('COALESCE(released_on, first_published_on) DESC NULLS LAST')) }
scope :best_selling, -> { left_joins(:purchases).group(:id).order('COUNT(purchases.id) DESC') }
- scope :recently_published, -> { order(first_published_on: :desc) }
+ scope :recently_released, -> { where.not(released_on: nil).order(released_on: :desc) }
after_commit :transcode_tracks, on: :update, if: :metadata_or_cover_changed?
diff --git a/app/views/interests/new.html.erb b/app/views/interests/new.html.erb
index b4b2b00..1fbc652 100644
--- a/app/views/interests/new.html.erb
+++ b/app/views/interests/new.html.erb
@@ -12,10 +12,10 @@
<%= render(
- SectionComponent.new(title: 'Recently added')
+ SectionComponent.new(title: 'Recently released')
) do %>
<%= render(CardGridComponent.new) do %>
- <% Album.recently_published.limit(4).each do |album| %>
+ <% Album.recently_released.limit(4).each do |album| %>
<%= link_to(artist_album_path(album.artist, album)) do %>
<%= render(CardComponent.new(
title: album.title,
diff --git a/test/models/album_test.rb b/test/models/album_test.rb
index a85d679..985431d 100644
--- a/test/models/album_test.rb
+++ b/test/models/album_test.rb
@@ -211,12 +211,13 @@ class AlbumTest < ActiveSupport::TestCase
artist1 = create(:artist)
artist2 = create(:artist)
- older_album_artist1 = create(:album, artist: artist1, first_published_on: 4.months.ago)
- newer_album_artist1 = create(:album, artist: artist1, first_published_on: 3.months.ago)
- older_album_artist2 = create(:album, artist: artist2, first_published_on: 2.months.ago)
- newer_album_artist2 = create(:album, artist: artist2, first_published_on: 1.month.ago)
+ older_album_artist1 = create(:album, artist: artist1, released_on: 4.months.ago)
+ newer_album_artist1 = create(:album, artist: artist1, released_on: 3.months.ago)
+ older_album_artist2 = create(:album, artist: artist2, released_on: 2.months.ago)
+ newer_album_artist2 = create(:album, artist: artist2, released_on: 1.month.ago)
+ create(:album, artist: artist1, released_on: nil)
- recently_released = Album.recently_published.map(&:id)
+ recently_released = Album.recently_released.map(&:id)
assert_equal [newer_album_artist2.id,
older_album_artist2.id,