diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/prometheus_metric.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/prometheus_metric.rb b/app/models/prometheus_metric.rb index c7786500c5c..b29c054cb4d 100644 --- a/app/models/prometheus_metric.rb +++ b/app/models/prometheus_metric.rb @@ -14,7 +14,14 @@ class PrometheusMetric < ApplicationRecord validates :project, presence: true, unless: :common? validates :project, absence: true, if: :common? + scope :for_project, -> (project) { where(project_id: project) } + scope :for_group, -> (group) { where(group: group) } + scope :for_title, -> (title) { where(title: title) } + scope :for_y_label, -> (y_label) { where(y_label: y_label) } + scope :for_identifier, -> (identifier) { where(identifier: identifier) } + scope :for_identifier, -> (identifier) { where(identifier: identifier) } scope :common, -> { where(common: true) } + scope :order_created_at_asc, -> { reorder(created_at: :asc) } def priority group_details(group).fetch(:priority) |