修改最近一个月时间跨度

当前日期延生到上月的当天
szzh
huang 10 years ago
parent 2fca0f4441
commit e5801338d6

@ -628,7 +628,7 @@ update
def graph_author_commits_per_month(repository)
@date_to = Date.today
@date_from = @date_to << 1
@date_from = Date.civil(@date_from.year, @date_from.month, 1)
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(:all, :group => :committer,
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40)
@ -664,7 +664,7 @@ update
def author_commits_six_month(repository)
@date_to = Date.today
@date_from = @date_to << 6
@date_from = Date.civil(@date_from.year, @date_from.month, 1)
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(:all, :group => :committer,
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40)

Loading…
Cancel
Save