diff --git a/app/helpers/quality_analysis_helper.rb b/app/helpers/quality_analysis_helper.rb index 0454a6943..8356c476b 100644 --- a/app/helpers/quality_analysis_helper.rb +++ b/app/helpers/quality_analysis_helper.rb @@ -1,47 +1,69 @@ module QualityAnalysisHelper def sqale_rating_status val + arr = [] if val.to_i > 0 && val.to_i < 5 - "很好" + arr << "很好" + arr << "b_green2" elsif val.to_i > 5 && val.to_i < 10 - "较好" + arr << "较好" + arr << "b_slow_yellow" elsif val.to_i > 10 && val.to_i < 20 - "中等" + arr << "中等" + arr << "b_yellow" elsif val.to_i > 20 && val.to_i < 50 - "较差" + arr << "较差" + arr << "b_slow_red" elsif val.to_i > 20 - "很差" + arr << "很差" + arr << "b_red" end + arr.first end def complexity_status val + arr = [] if val.to_i < 10 - "良好" + arr << "良好" + arr << "b_green2" elsif val.to_i > 10 && val.to_i < 15 - "较高" + arr << "较高" + arr << "b_yellow" elsif val.to_i > 15 - "很高" + arr << "很高" + arr << "b_red" end + arr.first end def duplicated_lines_density_status val + arr = [] if val.to_i < 30 - "良好" + arr << "良好" + arr << "b_green2" elsif val.to_i > 30 && val.to_i < 50 - "较高" + arr << "较高" + arr << "b_yellow" elsif val.to_i > 50 - "很高" + arr << "很高" + arr << "b_red" end + arr.first end def comment_lines_density_status val + arr = [] if val.to_i < 20 - "较低" + arr << "较低" + arr << "b_yellow" elsif val.to_i > 20 && val.to_i < 50 - "正常" + arr << "正常" + arr << "b_green2" elsif val.to_i > 50 - "较高" + arr << "较高" + arr << "b_red" end + arr.first end def score_sqale_rating val diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 3b80d775c..86ff6782b 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -10,39 +10,39 @@
质量等级
-<%= @complexity["msr"][9]["frmt_val"] %>
+<%= @complexity["msr"][9]["frmt_val"] %>
复杂度
<%= @complexity["msr"][6]["val"] %>
重复
<%= @complexity["msr"][7]["frmt_val"] %>
注释率
<%= @complexity["msr"][5]["frmt_val"] %>