Class: Est::Champions
- Inherits:
-
Object
- Object
- Est::Champions
- Defined in:
- lib/est/methods/champions.rb
Overview
Scope Champions. see www.technoparkcorp.com/innovations/scope-champions/
Instance Method Summary collapse
-
#initialize(yaml) ⇒ Champions
constructor
Ctor.
-
#total ⇒ Object
Get total estimate.
Constructor Details
#initialize(yaml) ⇒ Champions
Ctor.
yaml
-
YAML config
38 39 40 |
# File 'lib/est/methods/champions.rb', line 38 def initialize(yaml) @yaml = yaml end |
Instance Method Details
#total ⇒ Object
Get total estimate.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/est/methods/champions.rb', line 43 def total n = @yaml['scope'].size champs = @yaml['champions'] m = champs.size k = 0.54 sum = champs.map do |i, e| total = (e['best-case'].to_i + e['worst-case'].to_i + e['most-likely'].to_i * 4) / 6 Est.log.info "#{i}: (#{e['best-case']} + #{e['worst-case']} +"\ " #{e['most-likely']} * 4) / 6 = #{total}" total end.reduce(&:+) total = sum * k * (n / m) Est.log.info "#{sum} * #{k} * (#{n} / #{m}) = #{total}" total.to_i end |