diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-03-15 18:03:37 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-03-15 18:04:17 +0900 |
commit | 8b0b8e3bc4b1832d7c66e88ec26a3e244a11fec5 (patch) | |
tree | b7b1a2d168472d34c1648349ecc482ae9a599795 /app/models/ci/build.rb | |
parent | c13887a1c219e8ff1a5134d7bd12529cfe656c77 (diff) | |
download | gitlab-ce-8b0b8e3bc4b1832d7c66e88ec26a3e244a11fec5.tar.gz |
Use with_artifacts_archive name. Add spec
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r-- | app/models/ci/build.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index dafad611060..5a381bdd6a2 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -41,12 +41,12 @@ module Ci scope :unstarted, ->() { where(runner_id: nil) } scope :ignore_failures, ->() { where(allow_failure: false) } - scope :with_artifacts, ->(file_type) do + scope :with_artifacts_archive, ->() do where('(artifacts_file IS NOT NULL AND artifacts_file <> ?) OR EXISTS (?)', - '', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').public_send(file_type)) # rubocop:disable GitlabSecurity/PublicSend + '', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').archive) end - scope :with_artifacts_not_expired, ->() { with_artifacts(:archive).where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) } - scope :with_expired_artifacts, ->() { with_artifacts(:archive).where('artifacts_expire_at < ?', Time.now) } + scope :with_artifacts_not_expired, ->() { with_artifacts_archive.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) } + scope :with_expired_artifacts, ->() { with_artifacts_archive.where('artifacts_expire_at < ?', Time.now) } scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) } scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + [:manual]) } scope :ref_protected, -> { where(protected: true) } |