Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r--app/models/deployment.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 7bcf7c702f6..f000e474605 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -38,6 +38,7 @@ class Deployment < ApplicationRecord
scope :for_status, -> (status) { where(status: status) }
scope :for_project, -> (project_id) { where(project_id: project_id) }
+ scope :for_projects, -> (projects) { where(project: projects) }
scope :visible, -> { where(status: %i[running success failed canceled]) }
scope :stoppable, -> { where.not(on_stop: nil).where.not(deployable_id: nil).success }
@@ -45,11 +46,8 @@ class Deployment < ApplicationRecord
scope :older_than, -> (deployment) { where('deployments.id < ?', deployment.id) }
scope :with_deployable, -> { joins('INNER JOIN ci_builds ON ci_builds.id = deployments.deployable_id').preload(:deployable) }
- scope :finished_between, -> (start_date, end_date = nil) do
- selected = where('deployments.finished_at >= ?', start_date)
- selected = selected.where('deployments.finished_at < ?', end_date) if end_date
- selected
- end
+ scope :finished_after, ->(date) { where('finished_at >= ?', date) }
+ scope :finished_before, ->(date) { where('finished_at < ?', date) }
FINISHED_STATUSES = %i[success failed canceled].freeze