Class: Est::Champions

Inherits:
Object
  • Object
show all
Defined in:
lib/est/methods/champions.rb

Overview

Instance Method Summary collapse

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

#totalObject

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'].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