@@ -414,17 +414,12 class Repository < ActiveRecord::Base | |||||
414 | # Notes: |
|
414 | # Notes: | |
415 | # - this hash honnors the users mapping defined for the repository |
|
415 | # - this hash honnors the users mapping defined for the repository | |
416 | def stats_by_author |
|
416 | def stats_by_author | |
417 | commits = Changeset.where("repository_id = ?", id) |
|
417 | commits = Changeset.where("repository_id = ?", id).select("committer, user_id, count(*) as count").group("committer, user_id") | |
418 | .select("committer, user_id, count(*) as count") |
|
|||
419 | .group("committer, user_id") |
|
|||
420 |
|
418 | |||
421 | #TODO: restore ordering ; this line probably never worked |
|
419 | #TODO: restore ordering ; this line probably never worked | |
422 | #commits.to_a.sort! {|x, y| x.last <=> y.last} |
|
420 | #commits.to_a.sort! {|x, y| x.last <=> y.last} | |
423 |
|
421 | |||
424 | changes = Change.joins(:changeset) |
|
422 | changes = Change.joins(:changeset).where("#{Changeset.table_name}.repository_id = ?", id).select("committer, user_id, count(*) as count").group("committer, user_id") | |
425 | .where("#{Changeset.table_name}.repository_id = ?", id) |
|
|||
426 | .select("committer, user_id, count(*) as count") |
|
|||
427 | .group("committer, user_id") |
|
|||
428 |
|
423 | |||
429 | user_ids = changesets.map(&:user_id).compact.uniq |
|
424 | user_ids = changesets.map(&:user_id).compact.uniq | |
430 | authors_names = User.where(:id => user_ids).inject({}) do |memo, user| |
|
425 | authors_names = User.where(:id => user_ids).inject({}) do |memo, user| |
General Comments 0
You need to be logged in to leave comments.
Login now