还原质量分析的代码

This commit is contained in:
cxt 2016-08-29 15:43:32 +08:00
parent acb18ca4c6
commit 4ff45c15a3
3 changed files with 8 additions and 12 deletions

View File

@ -248,12 +248,10 @@ class QualityAnalysisController < ApplicationController
author_infos.each do |author_info|
email = author_info.email
changes = author_info.changes.to_i
unresolved_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}&resolved=false").read
unresolved_issue_count = JSON.parse(unresolved_issues)["total"].to_i
all_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}").read
all_issue_count = JSON.parse(all_issues)["total"].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 : format("%0.4f",issue_count.to_f/changes.to_f))
@user_quality_infos << {:email => email, :changes => changes, :unresolved_issue_count => unresolved_issue_count, :ratio => ratio, :all_issue_count => all_issue_count}
@user_quality_infos << {:email => email, :changes => changes, :issue_count => issue_count, :ratio => ratio}
end
# 按名称转换成hash键值对

View File

@ -133,8 +133,7 @@
<ul class="contribute-list">
<li class="fl fontGrey2 contribute-list-avatar">&nbsp;</li>
<li class="fl fontGrey2 contribute-list-code">代码行数</li>
<li class="fl fontGrey2 contribute-list-problem">引入质量问题总数</li>
<li class="fl fontGrey2 contribute-list-problem">未解决质量问题数</li>
<li class="fl fontGrey2 contribute-list-problem">引入质量问题数</li>
<li class="fl fontGrey2 contribute-list-rate">引入质量问题数/代码行数</li>
<div class="cl"></div>
</ul>
@ -150,8 +149,7 @@
</div>
</li>
<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height"><%= author_info[:changes] %></li>
<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height"><%= author_info[:all_issue_count] %></li>
<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height"><%= author_info[:unresolved_issue_count] %></li>
<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height"><%= author_info[:issue_count] %></li>
<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height"><%= author_info[:ratio] %></li>
<div class="cl"></div>
</ul>

View File

@ -498,9 +498,9 @@ a:hover.upload_btn_grey{background:#8a8a8a;}
.image-cir {border-radius:50%;}
.analysis-genral-icon {position:absolute; padding:1px 5px; display:inline-block; top:5px;}
.contribute-list-avatar {width:80px; vertical-align:middle; text-align:center;}
.contribute-list-code {width:130px; vertical-align:middle; text-align:center;}
.contribute-list-problem {width:130px; vertical-align:middle; text-align:center;}
.contribute-list-rate {width:168px; vertical-align:middle; text-align:center;}
.contribute-list-code {width:160px; vertical-align:middle; text-align:center;}
.contribute-list-problem {width:170px; vertical-align:middle; text-align:center;}
.contribute-list-rate {width:228px; vertical-align:middle; text-align:center;}
.contribute-list-height {height:80px;}
.contribute-list-line-height {line-height:80px;}