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
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