Commit 69bd9501 authored by allison.browne's avatar allison.browne

Change query and add more test examples

parent d366c192
...@@ -65,7 +65,6 @@ class Issue < ApplicationRecord ...@@ -65,7 +65,6 @@ class Issue < ApplicationRecord
scope :public_only, -> { where(confidential: false) } scope :public_only, -> { where(confidential: false) }
scope :confidential_only, -> { where(confidential: true) } scope :confidential_only, -> { where(confidential: true) }
scope :with_zoom_meetings, -> { joins(:zoom_meetings).select(:issues).distinct }
after_commit :expire_etag_cache after_commit :expire_etag_cache
after_save :ensure_metrics, unless: :imported? after_save :ensure_metrics, unless: :imported?
......
...@@ -79,7 +79,7 @@ module Gitlab ...@@ -79,7 +79,7 @@ module Gitlab
groups: count(Group), groups: count(Group),
issues: count(Issue), issues: count(Issue),
issues_with_associated_zoom_link: count(ZoomMeeting.added_to_issue), issues_with_associated_zoom_link: count(ZoomMeeting.added_to_issue),
issues_using_zoom_quick_actions: count(Issue.with_zoom_meetings), issues_using_zoom_quick_actions: count(ZoomMeeting.select(:issue_id).distinct),
keys: count(Key), keys: count(Key),
label_lists: count(List.label), label_lists: count(List.label),
lfs_objects: count(LfsObject), lfs_objects: count(LfsObject),
......
...@@ -21,9 +21,14 @@ describe Gitlab::UsageData do ...@@ -21,9 +21,14 @@ describe Gitlab::UsageData do
create(:project_error_tracking_setting, project: projects[1], enabled: false) create(:project_error_tracking_setting, project: projects[1], enabled: false)
create(:issue, project: projects[0]) create(:issue, project: projects[0])
create(:issue, project: projects[0]) create(:issue, project: projects[0])
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[0]) create(:issue, project: projects[0])
create(:issue, project: projects[0])
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[0], issue_status: :added)
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[1], issue_status: :removed) create(:zoom_meeting, project: projects[0], issue: projects[0].issues[1], issue_status: :removed)
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[1], issue_status: :removed) create(:zoom_meeting, project: projects[0], issue: projects[0].issues[1], issue_status: :removed)
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[2], issue_status: :added)
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[2], issue_status: :removed)
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[2], issue_status: :removed)
gcp_cluster = create(:cluster, :provided_by_gcp) gcp_cluster = create(:cluster, :provided_by_gcp)
create(:cluster, :provided_by_user) create(:cluster, :provided_by_user)
create(:cluster, :provided_by_user, :disabled) create(:cluster, :provided_by_user, :disabled)
...@@ -182,8 +187,8 @@ describe Gitlab::UsageData do ...@@ -182,8 +187,8 @@ describe Gitlab::UsageData do
expect(count_data[:projects_slack_slash_active]).to eq(1) expect(count_data[:projects_slack_slash_active]).to eq(1)
expect(count_data[:projects_with_repositories_enabled]).to eq(3) expect(count_data[:projects_with_repositories_enabled]).to eq(3)
expect(count_data[:projects_with_error_tracking_enabled]).to eq(1) expect(count_data[:projects_with_error_tracking_enabled]).to eq(1)
expect(count_data[:issues_with_associated_zoom_link]).to eq(1) expect(count_data[:issues_with_associated_zoom_link]).to eq(2)
expect(count_data[:issues_using_zoom_quick_actions]).to eq(2) expect(count_data[:issues_using_zoom_quick_actions]).to eq(3)
expect(count_data[:clusters_enabled]).to eq(7) expect(count_data[:clusters_enabled]).to eq(7)
expect(count_data[:project_clusters_enabled]).to eq(6) expect(count_data[:project_clusters_enabled]).to eq(6)
......
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