@@ -414,17 +414,12 class Repository < ActiveRecord::Base | |||
|
414 | 414 | # Notes: |
|
415 | 415 | # - this hash honnors the users mapping defined for the repository |
|
416 | 416 | def stats_by_author |
|
417 | commits = Changeset.where("repository_id = ?", id) | |
|
418 | .select("committer, user_id, count(*) as count") | |
|
419 | .group("committer, user_id") | |
|
417 | commits = Changeset.where("repository_id = ?", id).select("committer, user_id, count(*) as count").group("committer, user_id") | |
|
420 | 418 | |
|
421 | 419 | #TODO: restore ordering ; this line probably never worked |
|
422 | 420 | #commits.to_a.sort! {|x, y| x.last <=> y.last} |
|
423 | 421 | |
|
424 | changes = Change.joins(:changeset) | |
|
425 | .where("#{Changeset.table_name}.repository_id = ?", id) | |
|
426 | .select("committer, user_id, count(*) as count") | |
|
427 | .group("committer, user_id") | |
|
422 | changes = Change.joins(:changeset).where("#{Changeset.table_name}.repository_id = ?", id).select("committer, user_id, count(*) as count").group("committer, user_id") | |
|
428 | 423 | |
|
429 | 424 | user_ids = changesets.map(&:user_id).compact.uniq |
|
430 | 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