diff --git a/Gemfile.lock b/Gemfile.lock index c38396b6a..076626e68 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -562,6 +562,7 @@ GEM zeitwerk (2.6.13) PLATFORMS + x86_64-linux x86_64-linux-musl DEPENDENCIES diff --git a/app/controllers/concerns/submission_filter.rb b/app/controllers/concerns/submission_filter.rb index b4f3bfdba..de5e0fa00 100644 --- a/app/controllers/concerns/submission_filter.rb +++ b/app/controllers/concerns/submission_filter.rb @@ -187,6 +187,10 @@ def filters_params(params, includes: BROWSE_ATTRIBUTES.join(','), page: 1, pages @filters[:search] = params[:search] end + unless params[:portals].blank? + @filters[:portals] = params[:portals] + end + request_params.delete(:order_by) if %w[visits fair].include?(request_params[:sort_by].to_s) request_params end @@ -215,7 +219,7 @@ def ontology_hash(ont, submissions) o[:note_count] = ont.notes&.length || 0 o[:project_count] = ont.projects&.length || 0 - o[:popularity] = @analytics[ont.acronym] || 0 + o[:popularity] = @analytics[ont.id.to_s] || 0 o[:rank] = sub ? sub[:rank] : 0 o @@ -324,10 +328,12 @@ def check_id(name_value, objects, name_key) def object_filter(objects, object_name, name_key = 'acronym') checks = params[object_name]&.split(',') || [] - checks = checks.map { |x| check_id(x, objects, name_key) }.compact + checks = checks.map { |x| helpers.link_last_part(check_id(x, objects, name_key)) }.compact - ids = objects.map { |x| x['id'] } + objects.uniq! { |x| helpers.link_last_part(x['id']) } + ids = objects.map { |x| helpers.link_last_part(x['id']) } count = ids.count { |x| checks.include?(x) } + [objects, checks, count] end @@ -348,7 +354,7 @@ def count_objects(ontologies) object_names.each do |name| values = Array(ontology[name]) values.each do |v| - v.gsub!('http://data.bioontology.org', rest_url) + v = helpers.link_last_part(v) objects_count[name] = {} unless objects_count[name] objects_count[name][v] = (objects_count[name][v] || 0) + 1 diff --git a/app/controllers/ontologies_controller.rb b/app/controllers/ontologies_controller.rb index 42f501f89..1474cc6a0 100644 --- a/app/controllers/ontologies_controller.rb +++ b/app/controllers/ontologies_controller.rb @@ -50,8 +50,8 @@ def ontologies_filter streams = [prepend("ontologies_list_view-page-#{@page.page}", partial: 'ontologies/browser/ontologies')] streams += @count_objects.map do |section, values_count| values_count.map do |value, count| - replace("count_#{section}_#{value}") do - helpers.turbo_frame_tag("count_#{section}_#{value}") do + replace("count_#{section}_#{link_last_part(value)}") do + helpers.turbo_frame_tag("count_#{section}_#{link_last_part(value)}") do helpers.content_tag(:span, count.to_s, class: "hide-if-loading #{count.zero? ? 'disabled' : ''}") end end