diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-12 19:26:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-12 19:26:10 +0300 |
commit | 6653ccc011dec86e5140a5d09ea3b2357eab6714 (patch) | |
tree | 897193f37bcd98152a0ac214f80a3c4cfe1047c5 /app/models/ci/daily_build_group_report_result.rb | |
parent | bff35a05aed6a31380a73c39113808fd262c2c37 (diff) |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc41
Diffstat (limited to 'app/models/ci/daily_build_group_report_result.rb')
-rw-r--r-- | app/models/ci/daily_build_group_report_result.rb | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/app/models/ci/daily_build_group_report_result.rb b/app/models/ci/daily_build_group_report_result.rb index 23c96e63724..5dcf575abd7 100644 --- a/app/models/ci/daily_build_group_report_result.rb +++ b/app/models/ci/daily_build_group_report_result.rb @@ -4,7 +4,6 @@ module Ci class DailyBuildGroupReportResult < ApplicationRecord extend Gitlab::Ci::Model - REPORT_WINDOW = 90.days PARAM_TYPES = %w[coverage].freeze belongs_to :last_pipeline, class_name: 'Ci::Pipeline', foreign_key: :last_pipeline_id @@ -13,13 +12,11 @@ module Ci 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) } @@ -29,17 +26,6 @@ module Ci def upsert_reports(data) upsert_all(data, unique_by: :index_daily_build_group_report_results_unique_columns) if data.any? end - - def recent_results(attrs, limit: nil) - where(attrs).order(date: :desc, group_name: :asc).limit(limit) - end - - def report_window(start_date) - default_date = REPORT_WINDOW.ago.to_date - date = Date.parse(start_date) rescue default_date - - [date, default_date].max - end end end end |