diff options
Diffstat (limited to 'lib/gitlab/usage_data_counters/note_counter.rb')
-rw-r--r-- | lib/gitlab/usage_data_counters/note_counter.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/usage_data_counters/note_counter.rb b/lib/gitlab/usage_data_counters/note_counter.rb index 672450ec82b..7a76180cb08 100644 --- a/lib/gitlab/usage_data_counters/note_counter.rb +++ b/lib/gitlab/usage_data_counters/note_counter.rb @@ -25,12 +25,20 @@ module Gitlab::UsageDataCounters def totals COUNTABLE_TYPES.map do |countable_type| - [:"#{countable_type.underscore}_comment", read(:create, countable_type)] + [counter_key(countable_type), read(:create, countable_type)] end.to_h end + def fallback_totals + COUNTABLE_TYPES.map { |counter_key| [counter_key(counter_key), -1] }.to_h + end + private + def counter_key(countable_type) + "#{countable_type.underscore}_comment".to_sym + end + def countable?(noteable_type) COUNTABLE_TYPES.include?(noteable_type.to_s) end |