Class: Decidim::Accountability::ResultsCalculator
- Inherits:
-
Object
- Object
- Decidim::Accountability::ResultsCalculator
- Defined in:
- app/services/decidim/accountability/results_calculator.rb
Overview
This class handles the calculation of progress for a set of results
Instance Method Summary collapse
-
#initialize(component, scope_id, category_id) ⇒ ResultsCalculator
constructor
Public: Initializes the service.
- #progress ⇒ Object
Constructor Details
#initialize(component, scope_id, category_id) ⇒ ResultsCalculator
Public: Initializes the service.
8 9 10 11 12 |
# File 'app/services/decidim/accountability/results_calculator.rb', line 8 def initialize(component, scope_id, category_id) @component = component @scope_id = scope_id @category_id = category_id end |
Instance Method Details
#progress ⇒ Object
16 17 18 |
# File 'app/services/decidim/accountability/results_calculator.rb', line 16 def progress results.average("COALESCE(progress, 0)") end |