提交次数代码简化
This commit is contained in:
parent
c0da9257cd
commit
2fca0f4441
|
@ -633,17 +633,11 @@ update
|
|||
: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)
|
||||
|
||||
changes_by_author = Change.count(:all, :group => :committer, :include => :changeset,
|
||||
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
||||
h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o}
|
||||
|
||||
fields = commits_by_author.collect {|r| r.first}
|
||||
commits_data = commits_by_author.collect {|r| r.last}
|
||||
changes_data = commits_by_author.collect {|r| h[r.first] || 0}
|
||||
|
||||
fields = fields + [""]*(10 - fields.length) if fields.length<10
|
||||
commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10
|
||||
changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10
|
||||
|
||||
# Remove email adress in usernames
|
||||
fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') }
|
||||
|
@ -663,10 +657,6 @@ update
|
|||
:data => commits_data,
|
||||
:title => l(:label_revision_plural)
|
||||
)
|
||||
# graph.add_data(
|
||||
# :data => changes_data,
|
||||
# :title => l(:label_change_plural)
|
||||
# )
|
||||
graph.burn
|
||||
end
|
||||
|
||||
|
@ -679,17 +669,11 @@ update
|
|||
: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)
|
||||
|
||||
changes_by_author = Change.count(:all, :group => :committer, :include => :changeset,
|
||||
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
||||
h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o}
|
||||
|
||||
fields = commits_by_author.collect {|r| r.first}
|
||||
commits_data = commits_by_author.collect {|r| r.last}
|
||||
changes_data = commits_by_author.collect {|r| h[r.first] || 0}
|
||||
|
||||
fields = fields + [""]*(10 - fields.length) if fields.length<10
|
||||
commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10
|
||||
changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10
|
||||
|
||||
# Remove email adress in usernames
|
||||
fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') }
|
||||
|
@ -709,10 +693,6 @@ update
|
|||
:data => commits_data,
|
||||
:title => l(:label_revision_plural)
|
||||
)
|
||||
# graph.add_data(
|
||||
# :data => changes_data,
|
||||
# :title => l(:label_change_plural)
|
||||
# )
|
||||
graph.burn
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue