summaryrefslogtreecommitdiffstats
path: root/app/controllers/repositories_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-01 21:12:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-01 21:12:47 +0000
commit38011c0fb11b098bb697ac850ea6aeeacbe0c056 (patch)
tree867f45a3f011c643e071d06aa8f5867b9fb8c329 /app/controllers/repositories_controller.rb
parentd1372107e5409d008f1a6c99eb4231c524df78d6 (diff)
downloadredmine-38011c0fb11b098bb697ac850ea6aeeacbe0c056.tar.gz
redmine-38011c0fb11b098bb697ac850ea6aeeacbe0c056.zip
Fixed error on commits per month graph (#10806).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9610 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/repositories_controller.rb')
-rw-r--r--app/controllers/repositories_controller.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index fb12ce373..f02bd8b70 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -347,13 +347,13 @@ class RepositoriesController < ApplicationController
:all, :group => :commit_date,
:conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @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 }
+ commits_by_day.each {|c| commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
changes_by_day = Change.count(
:all, :group => :commit_date, :include => :changeset,
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @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 }
+ changes_by_day.each {|c| changes_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
fields = []
12.times {|m| fields << month_name(((Date.today.month - 1 - m) % 12) + 1)}