Commit ccdab743 authored by Stan Hu's avatar Stan Hu

Merge branch '31383-count-issues-usage-ping-for-zoom-association' into 'master'

Count how many zoom calls are linked to issues

See merge request gitlab-org/gitlab!18967
parents d30307e3 1833ae5e
# frozen_string_literal: true
class AddIndexToZoomMeetings < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :zoom_meetings, :issue_status
end
def down
remove_concurrent_index :zoom_meetings, :issue_status if index_exists?(:zoom_meetings, :issue_status)
end
end
...@@ -4042,6 +4042,7 @@ ActiveRecord::Schema.define(version: 2019_10_26_124116) do ...@@ -4042,6 +4042,7 @@ ActiveRecord::Schema.define(version: 2019_10_26_124116) do
t.string "url", limit: 255 t.string "url", limit: 255
t.index ["issue_id", "issue_status"], name: "index_zoom_meetings_on_issue_id_and_issue_status", unique: true, where: "(issue_status = 1)" t.index ["issue_id", "issue_status"], name: "index_zoom_meetings_on_issue_id_and_issue_status", unique: true, where: "(issue_status = 1)"
t.index ["issue_id"], name: "index_zoom_meetings_on_issue_id" t.index ["issue_id"], name: "index_zoom_meetings_on_issue_id"
t.index ["issue_status"], name: "index_zoom_meetings_on_issue_status"
t.index ["project_id"], name: "index_zoom_meetings_on_project_id" t.index ["project_id"], name: "index_zoom_meetings_on_project_id"
end end
......
...@@ -78,6 +78,8 @@ module Gitlab ...@@ -78,6 +78,8 @@ module Gitlab
in_review_folder: count(::Environment.in_review_folder), in_review_folder: count(::Environment.in_review_folder),
groups: count(Group), groups: count(Group),
issues: count(Issue), issues: count(Issue),
issues_with_associated_zoom_link: count(ZoomMeeting.added_to_issue),
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),
......
...@@ -19,7 +19,11 @@ describe Gitlab::UsageData do ...@@ -19,7 +19,11 @@ describe Gitlab::UsageData do
create(:service, project: projects[2], type: 'SlackService', active: true) create(:service, project: projects[2], type: 'SlackService', active: true)
create(:project_error_tracking_setting, project: projects[0]) create(:project_error_tracking_setting, project: projects[0])
create(:project_error_tracking_setting, project: projects[1], enabled: false) create(:project_error_tracking_setting, project: projects[1], enabled: false)
create_list(:issue, 4, project: projects[0])
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[0], issue_status: :added)
create_list(:zoom_meeting, 2, 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_list(:zoom_meeting, 2, 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)
...@@ -125,6 +129,8 @@ describe Gitlab::UsageData do ...@@ -125,6 +129,8 @@ describe Gitlab::UsageData do
in_review_folder in_review_folder
groups groups
issues issues
issues_with_associated_zoom_link
issues_using_zoom_quick_actions
keys keys
label_lists label_lists
labels labels
...@@ -176,6 +182,8 @@ describe Gitlab::UsageData do ...@@ -176,6 +182,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(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