diff options
Diffstat (limited to 'app/models/ci/daily_build_group_report_result.rb')
-rw-r--r-- | app/models/ci/daily_build_group_report_result.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/ci/daily_build_group_report_result.rb b/app/models/ci/daily_build_group_report_result.rb index e9f3366b939..23c96e63724 100644 --- a/app/models/ci/daily_build_group_report_result.rb +++ b/app/models/ci/daily_build_group_report_result.rb @@ -9,14 +9,19 @@ module Ci belongs_to :last_pipeline, class_name: 'Ci::Pipeline', foreign_key: :last_pipeline_id belongs_to :project + belongs_to :group validates :data, json_schema: { filename: "daily_build_group_report_result_data" } scope :with_included_projects, -> { includes(:project) } + scope :by_ref_path, -> (ref_path) { where(ref_path: ref_path) } scope :by_projects, -> (ids) { where(project_id: ids) } + scope :by_group, -> (group_id) { where(group_id: group_id) } scope :with_coverage, -> { where("(data->'coverage') IS NOT NULL") } scope :with_default_branch, -> { where(default_branch: true) } scope :by_date, -> (start_date) { where(date: report_window(start_date)..Date.current) } + scope :by_dates, -> (start_date, end_date) { where(date: start_date..end_date) } + scope :ordered_by_date_and_group_name, -> { order(date: :desc, group_name: :asc) } store_accessor :data, :coverage |