Skip to content
Snippets Groups Projects
Commit 7b6cb9d6 authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Merge branch 'bug/fix-crc-dataset-show-on-group-with-status' into 'develop'

Show all crc dataset on group show page either work  in review or published

See merge request FDM/rdm-system/rdms!135
parents 6db086a4 3b9291e1
No related branches found
Tags v0.3.6
1 merge request!135Show all crc dataset on group show page either work in review or published
Pipeline #6681 failed
...@@ -12,7 +12,8 @@ module Hyrax ...@@ -12,7 +12,8 @@ module Hyrax
self.is_tombstoned_field = 'is_tombstoned_ssim' self.is_tombstoned_field = 'is_tombstoned_ssim'
# Defines which search_params_logic should be used when searching for Collection members # Defines which search_params_logic should be used when searching for Collection members
self.default_processor_chain += %i[member_of_collection filter_by_crc_work_type filter_by_is_tombstoned] self.default_processor_chain -= %i[only_active_works]
self.default_processor_chain += %i[member_of_collection filter_by_crc_work_type filter_by_is_tombstoned filter_by_active_works]
# @param [Object] scope Typically the controller object # @param [Object] scope Typically the controller object
# @param [Symbol] search_includes_models +:works+ or +:collections+; (anything else retrieves both) # @param [Symbol] search_includes_models +:works+ or +:collections+; (anything else retrieves both)
...@@ -21,11 +22,13 @@ module Hyrax ...@@ -21,11 +22,13 @@ module Hyrax
collection: nil, collection: nil,
search_includes_models: nil, search_includes_models: nil,
search_includes_crc_work_type: nil, search_includes_crc_work_type: nil,
search_includes_is_tombstoned: false) search_includes_is_tombstoned: false,
search_includes_only_active_works: false)
@collection = collection @collection = collection
@search_includes_models = search_includes_models @search_includes_models = search_includes_models
@search_includes_crc_work_type = search_includes_crc_work_type @search_includes_crc_work_type = search_includes_crc_work_type
@search_includes_is_tombstoned = search_includes_is_tombstoned @search_includes_is_tombstoned = search_includes_is_tombstoned
@search_includes_only_active_works = search_includes_only_active_works
if args.any? if args.any?
super(*args) super(*args)
else else
...@@ -41,7 +44,7 @@ module Hyrax ...@@ -41,7 +44,7 @@ module Hyrax
@search_includes_models || :works @search_includes_models || :works
end end
attr_accessor :search_includes_crc_work_type, :search_includes_is_tombstoned attr_accessor :search_includes_crc_work_type, :search_includes_is_tombstoned, :search_includes_only_active_works
# include filters into the query to only include the collection memebers # include filters into the query to only include the collection memebers
def member_of_collection(solr_parameters) def member_of_collection(solr_parameters)
...@@ -64,6 +67,13 @@ module Hyrax ...@@ -64,6 +67,13 @@ module Hyrax
solr_parameters[:fq] << "#{is_tombstoned_field}:#{search_includes_is_tombstoned}" solr_parameters[:fq] << "#{is_tombstoned_field}:#{search_includes_is_tombstoned}"
end end
def filter_by_active_works(solr_parameters)
return unless search_includes_only_active_works
solr_parameters[:fq] ||= []
solr_parameters[:fq] << '-suppressed_bsi:true'
end
# This overrides the models in FilterByType # This overrides the models in FilterByType
def models def models
work_classes + collection_classes work_classes + collection_classes
......
...@@ -50,6 +50,7 @@ module Hyrax ...@@ -50,6 +50,7 @@ module Hyrax
response, _docs = search_results do |builder| response, _docs = search_results do |builder|
builder.search_includes_models = :works builder.search_includes_models = :works
builder.search_includes_is_tombstoned = 'false' builder.search_includes_is_tombstoned = 'false'
builder.search_includes_only_active_works = user_params[:filter_by_active_works] || true
builder builder
end end
response response
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<% if work.crc_work_type.present? and work.crc_work_type[0] == 'experiment' %> <% if work.crc_work_type.present? and work.crc_work_type[0] == 'experiment' %>
<li> <li>
<%= link_to work.title[0], polymorphic_path([main_app, work]) %> <%= link_to work.title[0], polymorphic_path([main_app, work]) %>
<span class="badge" style="background-color: #198754"><%= work.workflow_state %></span>
</li> </li>
<% end %> <% end %>
<% end %> <% end %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment