添加一年提交次数

This commit is contained in:
huang 2015-07-26 13:43:56 +08:00
parent 3662baa0cf
commit 839cbf2a55
2 changed files with 8 additions and 6 deletions

View File

@ -626,14 +626,14 @@ update
graph.burn
end
# 用户每月提交次数
# 用户最近一年的提交次数
def graph_author_commits_per_month(repository)
@date_to = Date.today
@date_from = @date_to << 1
@date_from = @date_to << 12
@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)
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25)
fields = commits_by_author.collect {|r| r.first}
commits_data = commits_by_author.collect {|r| r.last}
@ -652,8 +652,9 @@ update
:scale_integers => true,
:show_data_values => true,
:rotate_y_labels => false,
:graph_title => l(:label_author_commits_per_month),
:show_graph_title => true
:graph_title => l(:label_author_commits_year),
:show_graph_title => true,
:no_css => true
)
graph.add_data(
:data => commits_data,
@ -735,7 +736,7 @@ update
)
graph.add_data(
:data => commits_data,
:title => l(:label_revision_plural)
:title => l(:lable_revision_code_count)
)
graph.burn
end

View File

@ -669,6 +669,7 @@ zh:
label_tag: 标签
label_revision: 修订
label_revision_plural: 修订
lable_revision_code_count: 代码量
label_revision_id: 修订 %{value}
label_associated_revisions: 相关修订版本
label_added: 已添加