summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-15 23:04:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-15 23:04:14 +0000
commit5b35bfd4344e90ee4d1663bb45312d83176efcaa (patch)
treecf04b53e4892659384d2ecb5f245f99d0d484faf /app
parent889d50089d4d98db83ba5617b526da50107be661 (diff)
downloadredmine-5b35bfd4344e90ee4d1663bb45312d83176efcaa.tar.gz
redmine-5b35bfd4344e90ee4d1663bb45312d83176efcaa.zip
Fixed: nil error on 'commits per month' graph.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@645 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/repositories_controller.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 2557f45c8..5bcba8e3a 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -134,12 +134,13 @@ private
def graph_commits_per_month(repository)
@date_to = Date.today
- @date_from = @date_to << 12
+ @date_from = @date_to << 11
+ @date_from = Date.civil(@date_from.year, @date_from.month, 1)
commits_by_day = repository.changesets.count(:all, :group => :commit_date, :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
commits_by_month = [0] * 12
commits_by_day.each {|c| commits_by_month[c.first.to_date.months_ago] += c.last }
- changes_by_day = repository.changes.count(:all, :group => :commit_date)
+ changes_by_day = repository.changes.count(:all, :group => :commit_date, :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
changes_by_month = [0] * 12
changes_by_day.each {|c| changes_by_month[c.first.to_date.months_ago] += c.last }