Skip to content

Commit

Permalink
Refs #23190 - replace .uniq with .distinct
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsherrill committed Apr 12, 2018
1 parent 6d7ca7c commit 458b610
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 0 additions & 10 deletions app/models/katello/content_view.rb
Expand Up @@ -353,16 +353,6 @@ def products(env = nil)
Product.joins(:repositories).where("#{Katello::Repository.table_name}.id" => repos.map(&:id)).distinct
end

def version_products(env)
repos = repos(env)
Product.joins(:repositories).where("#{Katello::Repository.table_name}.id" => repos.map(&:id)).distinct
end

#list all products associated to this view across all versions
def all_version_products
Product.joins(:repositories).where("#{Katello::Repository.table_name}.id" => self.all_version_repos).distinct
end

#get the library instances of all repos within this view
def all_version_library_instances
all_repos = all_version_repos.where(:library_instance_id => nil).pluck("#{Katello::Repository.table_name}.id")
Expand Down
5 changes: 5 additions & 0 deletions test/models/content_view_test.rb
Expand Up @@ -391,6 +391,11 @@ def test_add_repository_from_other_org
end
end

def test_products
refute_empty @library_view.products
refute_empty @library_View.products.redhat
end

def test_add_repository_from_other_view
view = @library_view
bad_repo = Repository.find(katello_repositories(:fedora_17_x86_64_library_view_1).id)
Expand Down

0 comments on commit 458b610

Please sign in to comment.