Class: AlertManagement::AlertsFinder
- Inherits:
-
Object
- Object
- AlertManagement::AlertsFinder
- Defined in:
- app/finders/alert_management/alerts_finder.rb
Class Method Summary collapse
-
.counts_by_status(current_user, project, params = {}) ⇒ Hash<Symbol,Integer>
Mapping of status id to count ex) { triggered: 6, …etc }.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, project, params) ⇒ AlertsFinder
constructor
A new instance of AlertsFinder.
Constructor Details
#initialize(current_user, project, params) ⇒ AlertsFinder
Returns a new instance of AlertsFinder.
11 12 13 14 15 |
# File 'app/finders/alert_management/alerts_finder.rb', line 11 def initialize(current_user, project, params) @current_user = current_user @project = project @params = params end |
Class Method Details
.counts_by_status(current_user, project, params = {}) ⇒ Hash<Symbol,Integer>
Returns Mapping of status id to count ex) { triggered: 6, …etc }.
7 8 9 |
# File 'app/finders/alert_management/alerts_finder.rb', line 7 def self.counts_by_status(current_user, project, params = {}) new(current_user, project, params).execute.counts_by_status end |
Instance Method Details
#execute ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/finders/alert_management/alerts_finder.rb', line 17 def execute return AlertManagement::Alert.none unless collection = project.alert_management_alerts collection = by_domain(collection) collection = by_status(collection) collection = by_iid(collection) collection = by_assignee(collection) collection = by_search(collection) sort(collection) end |