贡献列表
This commit is contained in:
parent
0cc59260cd
commit
60a76e64a5
|
@ -241,6 +241,19 @@ class QualityAnalysisController < ApplicationController
|
||||||
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read
|
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read
|
||||||
@complexity =JSON.parse(complexity_date).first
|
@complexity =JSON.parse(complexity_date).first
|
||||||
|
|
||||||
|
# 获取排名结果
|
||||||
|
@g = Gitlab.client
|
||||||
|
author_infos = @g.rep_user_stats(@project.gpid, :rev => @branch)
|
||||||
|
@user_quality_infos = []
|
||||||
|
author_infos.each do |author_info|
|
||||||
|
email = author_info.email
|
||||||
|
changes = author_info.changes.to_i
|
||||||
|
user_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}&resolved=false").read
|
||||||
|
issue_count = JSON.parse(user_issues)["total"].to_i
|
||||||
|
ratio = (changes == 0 ? 0 : issue_count%changes)
|
||||||
|
@user_quality_infos << {:email => email, :changes => changes, :issue_count => issue_count, :ratio => ratio}
|
||||||
|
end
|
||||||
|
|
||||||
# 按名称转换成hash键值对
|
# 按名称转换成hash键值对
|
||||||
@ha = {}
|
@ha = {}
|
||||||
@complexity["msr"].each do |com|
|
@complexity["msr"].each do |com|
|
||||||
|
|
|
@ -127,46 +127,33 @@
|
||||||
<p class="fontBlue2"><%= @ha["functions"].to_i %></p>
|
<p class="fontBlue2"><%= @ha["functions"].to_i %></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl">贡献统计</span></div>-->
|
<% unless @user_quality_infos.blank? %>
|
||||||
<!--<div class="analysis-block mt10 f12">-->
|
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl">贡献统计</span></div>
|
||||||
<!--<ul class="contribute-list">-->
|
<div class="analysis-block mt10 f12">
|
||||||
<!--<li class="fl fontGrey2 contribute-list-avatar"> </li>-->
|
<ul class="contribute-list">
|
||||||
<!--<li class="fl fontGrey2 contribute-list-code">代码行数</li>-->
|
<li class="fl fontGrey2 contribute-list-avatar"> </li>
|
||||||
<!--<li class="fl fontGrey2 contribute-list-problem">引入质量问题数</li>-->
|
<li class="fl fontGrey2 contribute-list-code">代码行数</li>
|
||||||
<!--<li class="fl fontGrey2 contribute-list-rate">引入质量问题数/代码行数</li>-->
|
<li class="fl fontGrey2 contribute-list-problem">引入质量问题数</li>
|
||||||
<!--<div class="cl"></div>-->
|
<li class="fl fontGrey2 contribute-list-rate">引入质量问题数/代码行数</li>
|
||||||
<!--</ul>-->
|
<div class="cl"></div>
|
||||||
<!--<ul class="contribute-list">-->
|
</ul>
|
||||||
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
|
||||||
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
<% @user_quality_infos.each do |author_info| %>
|
||||||
<!--<p class="fontGrey2 hidden">小明</p>-->
|
<% user = get_user_by_mail(author_info[:email]) %>
|
||||||
<!--</div>-->
|
<ul class="contribute-list">
|
||||||
<!--</li>-->
|
<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">
|
||||||
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">18340</li>-->
|
<div class="mt8">
|
||||||
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">230</li>-->
|
<%=link_to image_tag(url_to_avatar(user), :width => "50", :height => "30"), user_path(user), :class => "image-cir", :target => '_blank' %>
|
||||||
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.012540</li>-->
|
<p class="fontGrey2 hidden"><%=link_to (user.id == 2 ? author_info[:email] : user.show_name), user_path(user) %></p>
|
||||||
<!--<div class="cl"></div>-->
|
</div>
|
||||||
<!--</ul>-->
|
</li>
|
||||||
<!--<ul class="contribute-list">-->
|
<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height"><%= author_info[:changes] %></li>
|
||||||
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height"><%= author_info[:issue_count] %></li>
|
||||||
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height"><%= author_info[:ratio] %></li>
|
||||||
<!--<p class="fontGrey2 hidden">小王</p>-->
|
<div class="cl"></div>
|
||||||
<!--</div>-->
|
</ul>
|
||||||
<!--</li>-->
|
<% end %>
|
||||||
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">834</li>-->
|
|
||||||
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">34</li>-->
|
</div>
|
||||||
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.04077</li>-->
|
<% end %>
|
||||||
<!--<div class="cl"></div>-->
|
|
||||||
<!--</ul>-->
|
|
||||||
<!--<ul class="contribute-list">-->
|
|
||||||
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
|
||||||
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
|
||||||
<!--<p class="fontGrey2 hidden">小亮</p>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</li>-->
|
|
||||||
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">134</li>-->
|
|
||||||
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">10</li>-->
|
|
||||||
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.07462</li>-->
|
|
||||||
<!--<div class="cl"></div>-->
|
|
||||||
<!--</ul>-->
|
|
||||||
<!--</div>-->
|
|
||||||
|
|
|
@ -117,6 +117,11 @@ class Gitlab::Client
|
||||||
end
|
end
|
||||||
alias_method :repo_rep_stats, :rep_stats
|
alias_method :repo_rep_stats, :rep_stats
|
||||||
|
|
||||||
|
def rep_user_stats(project, options={})
|
||||||
|
get("/projects/#{project}/repository/rep_user_stats", :query => options)
|
||||||
|
end
|
||||||
|
alias_method :repo_rep_stats, :rep_stats
|
||||||
|
|
||||||
# Gets a tree activities of project repository.
|
# Gets a tree activities of project repository.
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
|
|
Loading…
Reference in New Issue