Commit 616f70e9 authored by Steve Abrams's avatar Steve Abrams

Remove .processed scope from package queries

Removes the scope that was specific to NuGet processing
packages. The status column and scopes are now used
in its place.
parent 7eac9815
...@@ -26,7 +26,6 @@ module Packages ...@@ -26,7 +26,6 @@ module Packages
.including_project_route .including_project_route
.including_tags .including_tags
.for_projects(group_projects_visible_to_current_user.select(:id)) .for_projects(group_projects_visible_to_current_user.select(:id))
.processed
.sort_by_attribute("#{params[:order_by]}_#{params[:sort]}") .sort_by_attribute("#{params[:order_by]}_#{params[:sort]}")
packages = filter_with_version(packages) packages = filter_with_version(packages)
......
...@@ -14,7 +14,6 @@ module Packages ...@@ -14,7 +14,6 @@ module Packages
def packages def packages
result = base.nuget result = base.nuget
.has_version .has_version
.processed
.with_name_like(@params[:package_name]) .with_name_like(@params[:package_name])
result = result.with_version(@params[:package_version]) if @params[:package_version].present? result = result.with_version(@params[:package_version]) if @params[:package_version].present?
result result
......
...@@ -13,7 +13,6 @@ module Packages ...@@ -13,7 +13,6 @@ module Packages
.including_project_route .including_project_route
.including_tags .including_tags
.displayable .displayable
.processed
.find(@package_id) .find(@package_id)
end end
end end
......
...@@ -17,7 +17,6 @@ module Packages ...@@ -17,7 +17,6 @@ module Packages
.including_build_info .including_build_info
.including_project_route .including_project_route
.including_tags .including_tags
.processed
packages = filter_with_version(packages) packages = filter_with_version(packages)
packages = filter_by_package_type(packages) packages = filter_by_package_type(packages)
packages = filter_by_package_name(packages) packages = filter_by_package_name(packages)
......
...@@ -10,7 +10,7 @@ module Packages ...@@ -10,7 +10,7 @@ module Packages
private private
def packages def packages
base.pypi.has_version.processed base.pypi.has_version
end end
end end
end end
......
...@@ -13,7 +13,7 @@ module Packages ...@@ -13,7 +13,7 @@ module Packages
private private
def packages def packages
base.pypi.has_version.processed base.pypi.has_version
end end
end end
end end
......
...@@ -117,11 +117,6 @@ class Packages::Package < ApplicationRecord ...@@ -117,11 +117,6 @@ class Packages::Package < ApplicationRecord
scope :without_nuget_temporary_name, -> { where.not(name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) } scope :without_nuget_temporary_name, -> { where.not(name: Packages::Nuget::TEMPORARY_PACKAGE_NAME) }
scope :has_version, -> { where.not(version: nil) } 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 :preload_files, -> { preload(:package_files) }
scope :last_of_each_version, -> { where(id: all.select('MAX(id) AS id').group(:version)) } scope :last_of_each_version, -> { where(id: all.select('MAX(id) AS id').group(:version)) }
scope :limit_recent, ->(limit) { order_created_desc.limit(limit) } scope :limit_recent, ->(limit) { order_created_desc.limit(limit) }
......
...@@ -122,7 +122,7 @@ RSpec.describe Packages::GroupPackagesFinder do ...@@ -122,7 +122,7 @@ RSpec.describe Packages::GroupPackagesFinder do
end end
context 'when there are processing packages' do 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]) } it { is_expected.to match_array([package1, package2]) }
end end
......
...@@ -24,7 +24,7 @@ RSpec.describe ::Packages::PackageFinder do ...@@ -24,7 +24,7 @@ RSpec.describe ::Packages::PackageFinder do
end end
context 'processing packages' do 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 } let(:package_id) { nuget_package.id }
it 'are not returned' do it 'are not returned' do
......
...@@ -76,7 +76,7 @@ RSpec.describe ::Packages::PackagesFinder do ...@@ -76,7 +76,7 @@ RSpec.describe ::Packages::PackagesFinder do
end end
context 'with processing packages' do 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]) } it { is_expected.to match_array([conan_package, maven_package]) }
end end
......
...@@ -606,22 +606,6 @@ RSpec.describe Packages::Package, type: :model do ...@@ -606,22 +606,6 @@ RSpec.describe Packages::Package, type: :model do
end end
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 describe '.limit_recent' do
let!(:package1) { create(:nuget_package) } let!(:package1) { create(:nuget_package) }
let!(:package2) { 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