diff --git a/app/controllers/contributions_controller.rb b/app/controllers/contributions_controller.rb index b146c8ca0..b0a340ca3 100644 --- a/app/controllers/contributions_controller.rb +++ b/app/controllers/contributions_controller.rb @@ -8,9 +8,15 @@ class ContributionsController < ApplicationController @project_menu_type = 12 # 计算每个分支每个人的贡献占比 - commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["repository_id = ?", @repository.id]) - Rails.logger.info(commits_by_author) - + project_id = @project.gpid + rev = "master" + g = Gitlab.client + begin + @static_total_per_user = g.rep_stats(project_id, :rev => rev) + rescue + render_404 + return + end render :layout => 'base_projects' end diff --git a/app/views/contributions/show.html.erb b/app/views/contributions/show.html.erb index 6df5cb2d4..41993e6c3 100644 --- a/app/views/contributions/show.html.erb +++ b/app/views/contributions/show.html.erb @@ -5,4 +5,25 @@ <% html_title(l(:label_calendar)) -%> + + +
+ + + + + + + + + <% @static_total_per_user.each do |static| %> + + + + + + + + <% end %> +
用户名代码总量增加代码删除代码变更代码
<%=static.uname %><%=static.commits_num %><%=static.add %><%=static.del %><%=static.changes %>
\ No newline at end of file