Sha256: be6cb21e9aa8abc8dc6752f03520f204eaae58e1111d17378e11cc7335d92d38

Contents?: true

Size: 976 Bytes

Versions: 43

Compression:

Stored size: 976 Bytes

Contents

module Katello
  class ContentViewPackageGroupFilter < ContentViewFilter
    CONTENT_TYPE = PackageGroup::CONTENT_TYPE

    has_many :package_group_rules, :dependent => :destroy, :foreign_key => :content_view_filter_id,
                                   :class_name => "Katello::ContentViewPackageGroupFilterRule"
    validates_lengths_from_database

    def generate_clauses(_repo)
      package_group_ids = package_group_rules.reject { |rule| rule.uuid.blank? }.flat_map.map(&:uuid)
      { "_id" => { "$in" => package_group_ids } } unless package_group_ids.empty?
    end

    def content_unit_pulp_ids(repo)
      package_group_hrefs = package_group_rules.reject { |rule| rule.uuid.blank? }.flat_map.map(&:uuid)
      package_group_names = repo.package_groups.
        where(:pulp_id => package_group_hrefs).collect { |package_group| package_group.package_names }.flatten.uniq
      repo.rpms.where(:name => package_group_names).pluck(:pulp_id).compact
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
katello-4.0.3 app/models/katello/content_view_package_group_filter.rb
katello-3.18.5 app/models/katello/content_view_package_group_filter.rb
katello-4.0.2.1 app/models/katello/content_view_package_group_filter.rb
katello-4.0.2 app/models/katello/content_view_package_group_filter.rb
katello-3.18.4 app/models/katello/content_view_package_group_filter.rb
katello-4.0.1.2 app/models/katello/content_view_package_group_filter.rb
katello-3.18.3.1 app/models/katello/content_view_package_group_filter.rb
katello-4.0.1.1 app/models/katello/content_view_package_group_filter.rb
katello-3.18.3 app/models/katello/content_view_package_group_filter.rb
katello-4.0.1 app/models/katello/content_view_package_group_filter.rb
katello-4.0.0 app/models/katello/content_view_package_group_filter.rb
katello-4.0.0.rc3.1 app/models/katello/content_view_package_group_filter.rb
katello-4.0.0.rc3 app/models/katello/content_view_package_group_filter.rb
katello-3.18.2.1 app/models/katello/content_view_package_group_filter.rb
katello-3.18.2 app/models/katello/content_view_package_group_filter.rb
katello-3.17.3 app/models/katello/content_view_package_group_filter.rb
katello-4.0.0.rc2 app/models/katello/content_view_package_group_filter.rb
katello-3.18.1.1 app/models/katello/content_view_package_group_filter.rb
katello-3.17.2 app/models/katello/content_view_package_group_filter.rb
katello-4.0.0.rc1 app/models/katello/content_view_package_group_filter.rb