Commit 16724319 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'refactor-jira-usage-ping-data' into 'master'

Refactor Jira usage ping data

See merge request gitlab-org/gitlab!36808
parents 7485ecc5 69124de2
...@@ -369,18 +369,15 @@ module Gitlab ...@@ -369,18 +369,15 @@ module Gitlab
projects_jira_active: 0 projects_jira_active: 0
} }
Service.active JiraService.active.includes(:jira_tracker_data).find_in_batches(batch_size: BATCH_SIZE) do |services|
.by_type(:JiraService)
.includes(:jira_tracker_data)
.find_in_batches(batch_size: BATCH_SIZE) do |services|
counts = services.group_by do |service| counts = services.group_by do |service|
# TODO: Simplify as part of https://gitlab.com/gitlab-org/gitlab/issues/29404 # TODO: Simplify as part of https://gitlab.com/gitlab-org/gitlab/issues/29404
service_url = service.data_fields&.url || (service.properties && service.properties['url']) service_url = service.data_fields&.url || (service.properties && service.properties['url'])
service_url&.include?('.atlassian.net') ? :cloud : :server service_url&.include?('.atlassian.net') ? :cloud : :server
end end
results[:projects_jira_server_active] += counts[:server].count if counts[:server] results[:projects_jira_server_active] += counts[:server].size if counts[:server]
results[:projects_jira_cloud_active] += counts[:cloud].count if counts[:cloud] results[:projects_jira_cloud_active] += counts[:cloud].size if counts[:cloud]
results[:projects_jira_active] += services.size results[:projects_jira_active] += services.size
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