版本库统计

This commit is contained in:
huang 2015-07-26 14:12:26 +08:00
parent 839cbf2a55
commit d89cba7a1f
1 changed files with 6 additions and 2 deletions

View File

@ -670,7 +670,7 @@ update
@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}
@ -705,7 +705,7 @@ update
@date_from = @date_to << 6
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(: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)
all_author = []
commits_by_author.each do |cba|
all_author << cba.first
@ -734,6 +734,10 @@ update
:graph_title => l(:label_author_code_six_month),
:show_graph_title => true
)
commits_data1 = [0]*12
graph.add_data(
:data => commits_data1,
)
graph.add_data(
:data => commits_data,
:title => l(:lable_revision_code_count)