Class: Gitlab::AlertManagement::AlertStatusCounts

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/alert_management/alert_status_counts.rb

Overview

Represents counts of each status or category of statuses

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(current_user, project, params) ⇒ AlertStatusCounts

Returns a new instance of AlertStatusCounts.


15
16
17
18
19
# File 'lib/gitlab/alert_management/alert_status_counts.rb', line 15

def initialize(current_user, project, params)
  @project = project
  @current_user = current_user
  @params = params
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.


9
10
11
# File 'lib/gitlab/alert_management/alert_status_counts.rb', line 9

def project
  @project
end

Class Method Details

.declarative_policy_classObject


11
12
13
# File 'lib/gitlab/alert_management/alert_status_counts.rb', line 11

def self.declarative_policy_class
  'AlertManagement::AlertPolicy'
end

Instance Method Details

#allObject


30
31
32
# File 'lib/gitlab/alert_management/alert_status_counts.rb', line 30

def all
  counts.values.sum
end

#openObject


26
27
28
# File 'lib/gitlab/alert_management/alert_status_counts.rb', line 26

def open
  counts[:triggered] + counts[:acknowledged]
end