mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-07 20:40:26 +08:00
Fix issues with my_module list service pagination [SCI-11923] (#8518)
This commit is contained in:
parent
7ac43bc613
commit
0c85a50f6f
2 changed files with 1 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Add table
Reference in a new issue