- block(:hour_of_week) do .blocktable %table %thead %tr %th Weekday - for i in 0..23 %th= i %tbody - max = stats.wday_stats.inject(0) do |r, i| - i[1].inject(r) do |r2, i2| - i2[1].commits > r2 ? i2[1].commits : r2 - for wday in 0..6 %tr %th= weekday(wday) - for hour in 0..23 - d = stats.wday_stats[(wday + 1) % 7] - s = d.nil? ? nil : d[hour] - cnt = s.nil? ? 0 : s.commits - percent = (100 * cnt / max).to_i - if cnt == 0 %td - else %td{:class => "gradient-#{percent}"}= cnt