get status

This commit is contained in:
Your Name 2016-06-23 18:24:22 +08:00
parent eca189335b
commit 0dc1a1c047
3 changed files with 56 additions and 17 deletions

View File

@ -1,2 +1,45 @@
module QualityAnalysisHelper
def sqale_rating_status val
if val.to_i > 0 && val.to_i < 5
"henhao"
elsif val.to_i > 5 && val.to_i < 10
elsif val.to_i > 10 && val.to_i < 20
elsif val.to_i > 20 && val.to_i < 50
"yiban"
elsif val.to_i > 20
"cha"
end
end
def complexity_status val
if val.to_i < 10
"zhengchang"
elsif val.to_i > 10 && val.to_i < 15
"yiban"
elsif val.to_i > 15
"cha"
end
end
def duplicated_lines_density_status val
if val.to_i < 30
"zhengchang"
elsif val.to_i > 30 && val.to_i < 50
"jiaogao"
elsif val.to_i > 50
"gao"
end
end
def comment_lines_density_status val
if val.to_i < 20
"paindi"
elsif val.to_i > 20 && val.to_i < 50
"jiaohao"
elsif val.to_i > 50
"hao"
end
end
end

View File

@ -44,12 +44,6 @@
}]
},
xAxis: {
style:{
fontSize: '18px'
}
},
// the value axis
yAxis: {
min: 0,
@ -100,7 +94,7 @@
},
series: [{
name: '代码质量',
data: [<%= @complexity["msr"][9]["frmt_val"] %>]
data: [<%= @complexity["msr"][9]["val"] %>]
// tooltip: {
// valueSuffix: ' km/h'
// }
@ -127,6 +121,7 @@
});
});
// function_complexity
$(function () {
$('#container_function_complexity').highcharts({
@ -175,7 +170,7 @@
// the value axis
yAxis: {
min: 0,
max: 100,
max: 30,
minorTickInterval: 'auto',
minorTickWidth: 1,
minorTickLength: 10,
@ -214,7 +209,7 @@
},
series: [{
name: '复杂度',
data: [<%= @complexity["msr"][5]["frmt_val"] %>]
data: [<%= @complexity["msr"][5]["val"] %>]
// tooltip: {
// valueSuffix: ' km/h'
// }
@ -334,7 +329,7 @@
},
series: [{
name: '重复率',
data: [<%= @complexity["msr"][7]["frmt_val"] %>]
data: [<%= @complexity["msr"][7]["val"] %>]
// tooltip: {
// valueSuffix: ' km/h'
// }
@ -459,7 +454,7 @@
},
series: [{
name: '质量等级',
data: [<%= @complexity["msr"][5]["frmt_val"] %>]
data: [<%= @complexity["msr"][5]["val"] %>]
// tooltip: {
// valueSuffix: ' km/h'
// }

View File

@ -8,12 +8,13 @@
<p> duplicated_lines_density: <%= @complexity["msr"][7]["frmt_val"] %></p>
<p> sqale_index: <%= @complexity["msr"][8]["frmt_val"] %></p>
<p> sqale_rating: <%= @complexity["msr"][9]["frmt_val"] %></p>
<%dd %>
<%# DD %>
<%= javascript_include_tag 'highcharts','highcharts-more' %>
<%= render :partial => "hightchars" %>
<div class="project_r_h">
<h2 class="project_h2" style="width:180px;">SonarQube质量分析</h2>
</div>
@ -26,24 +27,24 @@
<div class="analysis-genral">
<p id="container_sqale_rating" style="max-width:260px;min-height:260px;width:260px; margin:0 auto;"></p>
<p class="fontGrey3">质量等级</p>
<p class="fontBlue2 pr">A<span class="f8 c_white analysis-genral-icon b_green2 borderRadius">正常</span></p>
<p class="fontBlue2 pr"><%= @complexity["msr"][9]["frmt_val"] %><span class="f8 c_white analysis-genral-icon b_green2 borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"]) %></span></p>
</div>
<div class="analysis-genral" >
<p id="container_function_complexity" style="max-width:260px;min-height:260px;width:260px; margin:0 auto;"></p>
<p class="fontGrey3">复杂度</p>
<p class="fontBlue2 pr">44<span class="f8 c_white analysis-genral-icon b_green2 borderRadius">正常</span></p>
<p class="fontBlue2 pr"><%= @complexity["msr"][6]["val"] %><span class="f8 c_white analysis-genral-icon b_green2 borderRadius"><%= complexity_status(@complexity["msr"][6]["val"]) %></span></p>
</div>
</div>
<div class="flex">
<div class="analysis-genral">
<p id="container_duplicated_lines_density" style="max-width:260px;min-height:260px;width:260px; margin:0 auto;"></p>
<p class="fontGrey3 mt15">重复</p>
<p class="fontBlue2 pr">44%<span class="f8 c_white analysis-genral-icon b_green2 borderRadius">正常</span></p>
<p class="fontBlue2 pr"><%= @complexity["msr"][7]["frmt_val"] %><span class="f8 c_white analysis-genral-icon b_green2 borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"]) %></span></p>
</div>
<div class="analysis-genral">
<p id="container_comment_lines_density" style="max-width:260px;min-height:260px;width:260px; margin:0 auto;"></p>
<p class="fontGrey3">注释率</p>
<p class="fontBlue2 pr">12%<span class="f8 c_white analysis-genral-icon b_red borderRadius">偏低</span></p>
<p class="fontBlue2 pr"><%= @complexity["msr"][5]["frmt_val"] %><span class="f8 c_white analysis-genral-icon b_red borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"]) %></span></p>
</div>
</div>
</div>