Class: Decidim::Accountability::ResultsCalculator

Inherits:
Object
  • Object
show all
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

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

#progressObject



15
16
17
# File 'app/services/decidim/accountability/results_calculator.rb', line 15

def progress
  results.average("COALESCE(progress, 0)")
end