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, taxonomy_id) ⇒ ResultsCalculator
constructor
Public: Initializes the service.
- #progress ⇒ Object
Constructor Details
#initialize(component, taxonomy_id) ⇒ ResultsCalculator
Public: Initializes the service.
8 9 10 11 |
# File 'app/services/decidim/accountability/results_calculator.rb', line 8 def initialize(component, taxonomy_id) @component = component @taxonomy_id = taxonomy_id end |
Instance Method Details
#progress ⇒ Object
15 16 17 |
# File 'app/services/decidim/accountability/results_calculator.rb', line 15 def progress results.average("COALESCE(progress, 0)") end |