Class: Deployinator::Views::StatsLag

Inherits:
Stats
  • Object
show all
Defined in:
views/stats_lag.rb

Instance Method Summary collapse

Methods inherited from Stats

#deploys, #per_day, #timings

Instance Method Details

#time_to_deployObject

[

{
  :stack => "web",
  :data  => [[34321, 20], [34323, 10]]
}

]


11
12
13
14
15
16
17
18
19
20
# File 'views/stats_lag.rb', line 11

def time_to_deploy
  d_times = deploys[0..400].inject({}) do |h, deploy|
    if deploy[:new] && deploy[:stack] && deploy[:time] && !github_info_for_stack.key?(deploy[:stack].intern)
      h[deploy[:stack]] ||= []
      h[deploy[:stack]] << [deploy[:new].to_i, deploy[:time] - SVN.time_of_rev(deploy[:new])]
    end
    h
  end
  d_times.map { |key, timings| {:stack => key, :data => timings.to_json} }
end