From e17aa4c5d881537dbb8259449d0c4f2f38a0a54b Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 24 Jun 2016 11:20:39 +0800 Subject: [PATCH] color --- app/helpers/quality_analysis_helper.rb | 50 ++++++++++++++++------- app/views/quality_analysis/_show.html.erb | 22 +++++----- public/stylesheets/public.css | 3 ++ 3 files changed, 50 insertions(+), 25 deletions(-) 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"] %><%= sqale_rating_status(@complexity["msr"][9]["val"]) %>

+

<%= @complexity["msr"][9]["frmt_val"] %>} borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"]) %>

-

+

复杂度

<%= @complexity["msr"][6]["val"] %><%= complexity_status(@complexity["msr"][6]["val"]) %>

-

+

重复

<%= @complexity["msr"][7]["frmt_val"] %><%= duplicated_lines_density_status(@complexity["msr"][7]["val"]) %>

-

+

注释率

<%= @complexity["msr"][5]["frmt_val"] %><%=comment_lines_density_status(@complexity["msr"][5]["val"]) %>

-
质量等级<%= score_sqale_rating(@complexity["msr"][9]["val"]) %>/5分可定性评价为:质量<%= sqale_rating_status(@complexity["msr"][9]["val"]) %>
+
质量等级<%= score_sqale_rating(@complexity["msr"][9]["val"]) %>/5分可定性评价为:质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
技术债务<%= @complexity["msr"][8]["frmt_val"] %>查看详情
质量问题<%= @sonar_issues["msr"][0]["frmt_val"] %>问题分类如下:
-
阻断<%= @sonar_issues["msr"][1]["frmt_val"] %>%;">
-
严重<%= @sonar_issues["msr"][2]["frmt_val"] %>
-
主要<%= @sonar_issues["msr"][3]["frmt_val"] %>
-
次要<%= @sonar_issues["msr"][4]["frmt_val"] %>
-
信息<%= @sonar_issues["msr"][5]["frmt_val"] %>
+
阻断<%= @sonar_issues["msr"][1]["frmt_val"] %>%;">
+
严重<%= @sonar_issues["msr"][2]["frmt_val"] %>%;">
+
主要<%= @sonar_issues["msr"][3]["frmt_val"] %>%;">
+
次要<%= @sonar_issues["msr"][4]["frmt_val"] %>%;">
+
信息<%= @sonar_issues["msr"][5]["frmt_val"] %>%;">
代码规模可定性评价为:<%= lines_scale(@complexity["msr"][0]["frmt_val"]) %>
diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index c6d7853e5..743c81014 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -244,6 +244,9 @@ a.c_green{ color:#28be6c;} .c_dblue{ color:#09658c;} .b_blue{background:#64bdd9;} .b_green{background:#28be6c;} +.b_slow_yellow{background:#adde18;} +.b_yellow{background:#DDDF0D;} +.b_slow_red{background:#df8538;} .b_green2 {background:#63c360;} .b_red {background:#d60308;} .b_w{ background:#fff !important;}