Commit 96cfa063 authored by Sean McGivern's avatar Sean McGivern

Merge branch '324206-package-processed-scope-removal' into 'master'

Remove .processed scope from package model and finders

See merge request gitlab-org/gitlab!61732
parents 1a64c77b 616f70e9
......@@ -26,7 +26,6 @@ module Packages
.including_project_route
.including_tags
.for_projects(group_projects_visible_to_current_user.select(:id))
.processed
.sort_by_attribute("#{params[:order_by]}_#{params[:sort]}")
packages = filter_with_version(packages)
......
......@@ -14,7 +14,6 @@ module Packages
def packages
result = base.nuget
.has_version
.processed
.with_name_like(@params[:package_name])
result = result.with_version(@params[:package_version]) if @params[:package_version].present?
result
......
......@@ -13,7 +13,6 @@ module Packages
.including_project_route
.including_tags
.displayable
.processed
.find(@package_id)
end
end
......
......@@ -17,7 +17,6 @@ module Packages
.including_build_info
.including_project_route
.including_tags
.processed
packages = filter_with_version(packages)
packages = filter_by_package_type(packages)
packages = filter_by_package_name(packages)
......
......@@ -10,7 +10,7 @@ module Packages
private
def packages
base.pypi.has_version.processed
base.pypi.has_version
end
end
end
......
......@@ -13,7 +13,7 @@ module Packages
private
def packages
base.pypi.has_version.processed
base.pypi.has_version
end
end
end
......
......@@ -117,11 +117,6 @@ class Packages::Package < ApplicationRecord
scope :without_nuget_temporary_name, -> { where.not(name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) }
scope :has_version, -> { where.not(version: nil) }
scope :processed, -> do
where.not(package_type: :nuget).or(
where.not(name: Packages::Nuget::TEMPORARY_PACKAGE_NAME)
)
end
scope :preload_files, -> { preload(:package_files) }
scope :last_of_each_version, -> { where(id: all.select('MAX(id) AS id').group(:version)) }
scope :limit_recent, ->(limit) { order_created_desc.limit(limit) }
......
......@@ -122,7 +122,7 @@ RSpec.describe Packages::GroupPackagesFinder do
end
context 'when there are processing packages' do
let_it_be(:package4) { create(:nuget_package, project: project, name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) }
let_it_be(:package4) { create(:nuget_package, :processing, project: project) }
it { is_expected.to match_array([package1, package2]) }
end
......
......@@ -24,7 +24,7 @@ RSpec.describe ::Packages::PackageFinder do
end
context 'processing packages' do
let_it_be(:nuget_package) { create(:nuget_package, project: project, name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) }
let_it_be(:nuget_package) { create(:nuget_package, :processing, project: project) }
let(:package_id) { nuget_package.id }
it 'are not returned' do
......
......@@ -76,7 +76,7 @@ RSpec.describe ::Packages::PackagesFinder do
end
context 'with processing packages' do
let_it_be(:nuget_package) { create(:nuget_package, project: project, name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) }
let_it_be(:nuget_package) { create(:nuget_package, :processing, project: project) }
it { is_expected.to match_array([conan_package, maven_package]) }
end
......
......@@ -606,22 +606,6 @@ RSpec.describe Packages::Package, type: :model do
end
end
describe '.processed' do
let!(:package1) { create(:nuget_package) }
let!(:package2) { create(:npm_package) }
let!(:package3) { create(:nuget_package) }
subject { described_class.processed }
it { is_expected.to match_array([package1, package2, package3]) }
context 'with temporary packages' do
let!(:package1) { create(:nuget_package, name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) }
it { is_expected.to match_array([package2, package3]) }
end
end
describe '.limit_recent' do
let!(:package1) { create(:nuget_package) }
let!(:package2) { create(:nuget_package) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment