therealadam (owner)

Revisions

gist: 6597 Download_button fork
public
Public Clone URL: git://gist.github.com/6597.git
Embed All Files: show embed
Text #
1
2
3
4
5
6
7
8
9
10
11
window = 14
 
latest = Time.parse('12:00 AM')
earliest = today - window.days
 
issues = Issue.find(:conditions => ['updated_at > ? AND updated_at < ?', yesterday, today])
 
issues_by_day = Hash.new { |key| self[key] = [] }
issues_by_day = issues.injecting(issues_by_day) do |buckets, issue|
  buckets[issue.updated_at.strftime('%m/%d')] << issue
end