X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9daf42fbdb868939653c6e3ca8a4fffd1cf94e31..976f560ab04bf570ed58664d97b8b6069b314941:/apps/workbench/app/controllers/application_controller.rb diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 4f89f262b7..db00be390a 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -1094,7 +1094,7 @@ class ApplicationController < ActionController::Base pdhs.each do |x| @all_pdhs_for[x] = [] end - # TODO: make sure we get every page of results from API server + Collection.select(%w(portable_data_hash)).where(portable_data_hash: pdhs).distinct().each do |collection| @all_pdhs_for[collection.portable_data_hash] << collection end @@ -1120,10 +1120,14 @@ class ApplicationController < ActionController::Base return @objects_for if uuids.empty? # if already preloaded for all of these uuids, return - if not uuids.select { |x| @objects_for[x].nil? }.any? + if not uuids.select { |x| !@objects_for.include?(x) }.any? return @objects_for end + # preset all uuids to nil + uuids.each do |x| + @objects_for[x] = nil + end dataclass.where(uuid: uuids).each do |obj| @objects_for[obj.uuid] = obj end