Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminates duplicate Collection relation. #5669

Merged
merged 5 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/presenters/hyrax/work_show_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def grouped_presenters(filtered_by: nil, except: nil)
# TODO: we probably need to retain collection_presenters (as parent_presenters)
# and join this with member_of_collection_presenters
grouped = member_of_collection_presenters.group_by(&:model_name).transform_keys(&:human)
grouped.select! { |obj| obj.downcase == filtered_by } unless filtered_by.nil?
grouped.except!(*except) unless except.nil?
grouped.select! { |obj| obj.casecmp(filtered_by).zero? } unless filtered_by.nil?
grouped.reject! { |obj| except.map(&:downcase).include? obj.downcase } unless except.nil?
grouped
end

Expand Down
3 changes: 3 additions & 0 deletions spec/features/work_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
expect(page).to have_content collection.title.first
expect(page).to have_content work.title.first
expect(page).to have_selector '.alert-success', text: 'Collection was successfully updated.'

visit work_path
expect(page).to have_selector 'a', text: collection.title.first, count: 1
end
end

Expand Down