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/finders/pipeline_schedules_finder.rb')
-rw-r--r--app/finders/pipeline_schedules_finder.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/finders/pipeline_schedules_finder.rb b/app/finders/pipeline_schedules_finder.rb
new file mode 100644
index 00000000000..2ac4289fbbe
--- /dev/null
+++ b/app/finders/pipeline_schedules_finder.rb
@@ -0,0 +1,22 @@
+class PipelineSchedulesFinder
+ attr_reader :project, :pipeline_schedules
+
+ def initialize(project)
+ @project = project
+ @pipeline_schedules = project.pipeline_schedules
+ end
+
+ def execute(scope: nil)
+ scoped_schedules =
+ case scope
+ when 'active'
+ pipeline_schedules.active
+ when 'inactive'
+ pipeline_schedules.inactive
+ else
+ pipeline_schedules
+ end
+
+ scoped_schedules.order(id: :desc)
+ end
+end