diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-02 15:43:23 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-02 15:43:23 +0400 |
commit | 5a88873e5cac26edf65dcfae8d449beb4ed865bb (patch) | |
tree | 6c46297d86797ea1b94658124758aa65a21a79f5 /lib/api/repositories.rb | |
parent | 81d41c0f927f69d75937d3c8f757740e936ed6e9 (diff) |
Move API contributors logic to repository model
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r-- | lib/api/repositories.rb | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index ace3283616a..241036729b5 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -160,29 +160,7 @@ module API get ':id/repository/contributors' do authorize! :download_code, user_project - contributors = {} - contributors - - log = user_project.repository.graph_log - log.each do |entry| - email = entry[:author_email].to_s - - if contributors.has_key?(email) - contributors[email][:commits] += 1 - contributors[email][:additions] += entry[:additions] || 0 - contributors[email][:deletions] += entry[:deletions] || 0 - else - contributors[email] = { - email: email, - name: entry[:author_name], - commits: 1, - additions: entry[:additions] || 0, - deletions: entry[:deletions] || 0, - } - end - end - - contributors + user_project.repository.contributors end end end |