diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-08 06:08:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-08 06:08:10 +0000 |
commit | ae192a2f1410b5f71397a64df76238b9d3b0afbe (patch) | |
tree | 12e42b011fdb20dde6961609933c1004b45019c1 /lib/gitlab/usage_data.rb | |
parent | 3ecc3508dce791466f96f450d9eae7e73424306a (diff) | |
download | gitlab-ce-ae192a2f1410b5f71397a64df76238b9d3b0afbe.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/usage_data.rb')
-rw-r--r-- | lib/gitlab/usage_data.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb index 7934cc27808..47c927642b2 100644 --- a/lib/gitlab/usage_data.rb +++ b/lib/gitlab/usage_data.rb @@ -794,9 +794,8 @@ module Gitlab # rubocop: enable UsageData/LargeTable: 0.upto(series_amount - 1).map do |series| - # When there is an error with the query and it's not the Hash we expect, we return what we got from `count`. - sent_count = sent_emails.is_a?(Hash) ? sent_emails.fetch([track, series], 0) : sent_emails - clicked_count = clicked_emails.is_a?(Hash) ? clicked_emails.fetch([track, series], 0) : clicked_emails + sent_count = sent_in_product_marketing_email_count(sent_emails, track, series) + clicked_count = clicked_in_product_marketing_email_count(clicked_emails, track, series) result["in_product_marketing_email_#{track}_#{series}_sent"] = sent_count result["in_product_marketing_email_#{track}_#{series}_cta_clicked"] = clicked_count unless track == 'experience' @@ -805,6 +804,16 @@ module Gitlab end # rubocop: enable CodeReuse/ActiveRecord + def sent_in_product_marketing_email_count(sent_emails, track, series) + # When there is an error with the query and it's not the Hash we expect, we return what we got from `count`. + sent_emails.is_a?(Hash) ? sent_emails.fetch([track, series], 0) : sent_emails + end + + def clicked_in_product_marketing_email_count(clicked_emails, track, series) + # When there is an error with the query and it's not the Hash we expect, we return what we got from `count`. + clicked_emails.is_a?(Hash) ? clicked_emails.fetch([track, series], 0) : clicked_emails + end + def unique_visit_service strong_memoize(:unique_visit_service) do ::Gitlab::Analytics::UniqueVisits.new |