Fix issues with my_module list service pagination [SCI-11923] (#8518)

This commit is contained in:
Martin Artnik 2025-05-30 17:08:17 +02:00 committed by GitHub
parent 7ac43bc613
commit 0c85a50f6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 2 deletions

View file

@ -8,7 +8,7 @@ module Favoritable
scope :favorite_for, ->(user) { joins(:favorites).where(favorites: { user: user }) }
scope :with_favorites, lambda { |user|
joins("LEFT JOIN favorites ON item_id = #{table_name}.id AND item_type = '#{name}' AND favorites.user_id = #{user.id}")
joins("LEFT JOIN favorites ON favorites.item_id = #{table_name}.id AND favorites.item_type = '#{name}' AND favorites.user_id = #{user.id}")
.select("#{table_name}.*, favorites.id IS NOT NULL AS favorite")
}
end

View file

@ -17,7 +17,6 @@ module Lists
def fetch_records
@records = @raw_data.includes(PRELOAD)
.with_favorites(@user)
.group('my_modules.id, favorites.id')
view_mode = if @params[:experiment].archived_branch?
'archived'