Module: Workarea::Metrics::Scoring
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/workarea/metrics/scoring.rb
Instance Method Summary collapse
Instance Method Details
#score(field) ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/models/workarea/metrics/scoring.rb', line 16 def score(field) if weeks_ago.zero? send(field) else send(field) * (Workarea.config.score_decay / weeks_ago) end end |
#weeks_ago ⇒ Object
24 25 26 27 |
# File 'app/models/workarea/metrics/scoring.rb', line 24 def weeks_ago difference = Time.current.beginning_of_week - reporting_on.beginning_of_week difference / 1.week end |