Commit 73e4ec32 authored by allison.browne's avatar allison.browne

Move where clause to scopes in Issue model

parent 7fde8caa
......@@ -65,6 +65,8 @@ class Issue < ApplicationRecord
scope :with_project_grafana_integration, -> { includes(project: :grafana_integration).where(projects: { grafana_integrations: { enabled: true } } ) }
scope :with_api_entity_associations, -> { preload(:timelogs, :assignees, :author, :notes, :labels, project: [:route, { namespace: :route }] ) }
scope :grafana_embedded, -> { where(Issue.arel_table[:description_html].matches('%data-dashboard-url%'))
scope :public_only, -> { where(confidential: false) }
scope :confidential_only, -> { where(confidential: true) }
......
......@@ -4,9 +4,7 @@ module Gitlab
class GrafanaEmbedUsageData
class << self
def issue_count
Issue.with_project_grafana_integration.where(
Issue.arel_table[:description_html].matches('%data-dashboard-url%')
).count
Issue.with_project_grafana_integration.grafana_embedded.count
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment