Merge branch 'rep_quality' into develop

This commit is contained in:
huang 2016-07-11 11:34:07 +08:00
commit 1283690250
7 changed files with 31 additions and 34 deletions

View File

@ -227,9 +227,6 @@ class QualityAnalysisController < ApplicationController
end end
@ha.store(key,value) @ha.store(key,value)
end end
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
@sonar_issues = JSON.parse(issue_date).first
end end
rescue => e rescue => e
puts e puts e

View File

@ -3,16 +3,16 @@ module QualityAnalysisHelper
def sqale_rating_status val def sqale_rating_status val
arr = [] arr = []
if val < 5 if val <= 5
arr << "很好" arr << "很好"
arr << "b_green2" arr << "b_green2"
elsif val. > 5 && val < 10 elsif val. > 5 && val <= 10
arr << "较好" arr << "较好"
arr << "b_slow_yellow" arr << "b_slow_yellow"
elsif val > 10 && val < 20 elsif val > 10 && val <= 20
arr << "中等" arr << "中等"
arr << "b_yellow" arr << "b_yellow"
elsif val > 20 && val < 50 elsif val > 20 && val <= 50
arr << "较差" arr << "较差"
arr << "b_slow_red" arr << "b_slow_red"
elsif val > 20 elsif val > 20
@ -23,10 +23,10 @@ module QualityAnalysisHelper
def complexity_status val def complexity_status val
arr = [] arr = []
if val < 10 if val <= 10
arr << "良好" arr << "良好"
arr << "b_green2" arr << "b_green2"
elsif val > 10 && val < 15 elsif val > 10 && val <= 15
arr << "较高" arr << "较高"
arr << "b_yellow" arr << "b_yellow"
elsif val > 15 elsif val > 15
@ -37,10 +37,10 @@ module QualityAnalysisHelper
def duplicated_lines_density_status val def duplicated_lines_density_status val
arr = [] arr = []
if val < 30 if val <= 30
arr << "良好" arr << "良好"
arr << "b_green2" arr << "b_green2"
elsif val > 30 && val < 50 elsif val > 30 && val <= 50
arr << "较高" arr << "较高"
arr << "b_yellow" arr << "b_yellow"
elsif val > 50 elsif val > 50
@ -51,10 +51,10 @@ module QualityAnalysisHelper
def comment_lines_density_status val def comment_lines_density_status val
arr = [] arr = []
if val < 20 if val <= 20
arr << "较低" arr << "较低"
arr << "b_yellow" arr << "b_yellow"
elsif val > 20 && val < 50 elsif val > 20 && val <= 50
arr << "正常" arr << "正常"
arr << "b_green2" arr << "b_green2"
elsif val > 50 elsif val > 50
@ -64,15 +64,15 @@ module QualityAnalysisHelper
end end
def score_sqale_rating val def score_sqale_rating val
if val > 0 && val < 5 if val >= 0 && val <= 5
"5" "5"
elsif val > 5 && val < 10 elsif val > 5 && val <= 10
"4" "4"
elsif val > 10 && val < 20 elsif val > 10 && val <= 20
"3" "3"
elsif val > 20 && val < 50 elsif val > 20 && val <= 50
"2" "2"
elsif val > 20 elsif val > 50
"1" "1"
end end
end end

View File

@ -17,10 +17,10 @@
<% if @quality_analyses.count >0 %> <% if @quality_analyses.count >0 %>
<% @quality_analyses.each do |qa| %> <% @quality_analyses.each do |qa| %>
<ul class="analysis-result-list"> <ul class="analysis-result-list">
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2" %></li> <li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %></li>
<li class="analysis-result-version fl fontBlue2" title="分支名"><%= qa.branch %></li> <li class="analysis-result-version fl fontBlue2 hidden" title="分支名"><%= qa.branch %></li>
<li class="analysis-result-loc fl fontBlue2" title="语言"><%= qa.language %></li> <li class="analysis-result-loc fl fontBlue2 hidden" title="语言"><%= qa.language %></li>
<li class="analysis-result-debt fl fontBlue2" title="时间"><%= qa.path %></li> <li class="analysis-result-debt fl fontBlue2 hidden" title="路径"><%= qa.path %></li>
<% if User.current.try(:login) == qa.author_login %> <% if User.current.try(:login) == qa.author_login %>
<li class="analysis-result-time fl" title="编辑"> <li class="analysis-result-time fl" title="编辑">
<%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %> <%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %>

View File

@ -58,17 +58,17 @@
<span class="fontGrey2">可定性评价为:<span class="c_red">质量<%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %></span></span></div> <span class="fontGrey2">可定性评价为:<span class="c_red">质量<%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %></span></span></div>
<div class="analysis-block mt10 mb40 f14"> <div class="analysis-block mt10 mb40 f14">
<div><span class="fontGrey3 mr30">技术债务</span> <div><span class="fontGrey3 mr30">技术债务</span>
<span class="w70 pInline"> <span class="w100 pInline">
<% if @ha["sqale_index"].to_i == 0 %> <% if @ha["sqale_index"].to_i == 0 %>
0 0
<% else %> <% else %>
<%= /[0-9]*/.match(@ha["sqale_index"])[0] %>天 <%= /[0-9]*/.match(@ha["sqale_index"])[0] %>天
<%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? 0 : / [0-9]*/.match(@ha["sqale_index"]) %>小时 <%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? "" : (/ [0-9]*/.match(@ha["sqale_index"]).to_s + "小时") %>
<% end %> <% end %>
</span> </span>
<span class="fontGrey2"><a class="linkBlue2" target="_blank" href="<%= @sonar_address %>/drilldown/measures/<%= @resource_id %>?metric=sqale_index">查看详情</a></span></div> <span class="fontGrey2"><a class="linkBlue2" target="_blank" href="<%= @sonar_address %>/drilldown/measures/<%= @resource_id %>?metric=sqale_index">查看详情</a></span></div>
<div><span class="fontGrey3 mr30 fl">质量问题</span> <div><span class="fontGrey3 mr30 fl">&nbsp;质量问题</span>
<span class="fontBlue2 w70 pInline"> <span class="fontBlue2 w100 pInline">
<a class="fontBlue2 w70 pInline" target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false"> <a class="fontBlue2 w70 pInline" target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false">
<%= @ha["violations"].nil? ? 0 : @ha["violations"] %> <%= @ha["violations"].nil? ? 0 : @ha["violations"] %>
</a> </a>

View File

@ -18,7 +18,7 @@
<p>真实姓名:<%= User.find(ma.course_message_id).realname %></p> <p>真实姓名:<%= User.find(ma.course_message_id).realname %></p>
<p>申请课程:<%= Course.find(ma.course_id).name%></p> <p>申请课程:<%= Course.find(ma.course_id).name%></p>
<div class="fl">课程描述:</div> <div class="fl">课程描述:</div>
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe %></div> <div class="ml60"><%= Course.find(ma.course_id).description %></div>
<p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p> <p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
</div> </div>
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContentWarn2' : 'homepageHomeworkContentWarn' %> fl"> <li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContentWarn2' : 'homepageHomeworkContentWarn' %> fl">

View File

@ -569,7 +569,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
<% end %> <% end %>
<% if ma.course_message_type == "JoinCourseRequest" %> <% if ma.course_message_type == "JoinCourseRequest" && !ma.nil? %>
<ul class="homepageNewsList fl" id="course_message_join_<%=ma.id %>"> <ul class="homepageNewsList fl" id="course_message_join_<%=ma.id %>">
<%= render :partial => 'join_course_course_message', :locals => {:ma => ma} %> <%= render :partial => 'join_course_course_message', :locals => {:ma => ma} %>
</ul> </ul>

View File

@ -1273,11 +1273,11 @@ a.pages-big{ width:50px;}
.analysis-result-list {padding:5px;} .analysis-result-list {padding:5px;}
.analysis-result-list:nth-of-type(odd){background:#fff;}/*奇数行*/ .analysis-result-list:nth-of-type(odd){background:#fff;}/*奇数行*/
.analysis-result-list:nth-of-type(even){background:#f5f5f5;}/*偶数行*/ .analysis-result-list:nth-of-type(even){background:#f5f5f5;}/*偶数行*/
.analysis-result-name {width:200px; cursor:pointer;} .analysis-result-name {width:200px;}
.analysis-result-version {width:90px; text-align:right; cursor:pointer;} .analysis-result-version {width:90px; text-align:right;}
.analysis-result-loc {width:60px; text-align:right; cursor:pointer;} .analysis-result-loc {width:60px; text-align:right;}
.analysis-result-debt {width:160px; text-align:right; cursor:pointer;} .analysis-result-debt {width:160px; text-align:right;}
.analysis-result-time {width:150px; text-align:right; cursor:pointer;} .analysis-result-time {width:150px; text-align:right;}
.analysis-name-icon {background:url(../images/code-analysis-icon.png) -2px -148px no-repeat; width:16px; height:16px; display:inline-block; vertical-align:middle;} .analysis-name-icon {background:url(../images/code-analysis-icon.png) -2px -148px no-repeat; width:16px; height:16px; display:inline-block; vertical-align:middle;}
/*未登录回复提示*/ /*未登录回复提示*/