diff --git a/app/helpers/quality_analysis_helper.rb b/app/helpers/quality_analysis_helper.rb index 68ceb0996..0454a6943 100644 --- a/app/helpers/quality_analysis_helper.rb +++ b/app/helpers/quality_analysis_helper.rb @@ -68,4 +68,11 @@ module QualityAnalysisHelper end end + #统计答题百分比,统计结果保留两位小数 + def statistics_result_percentage(e, t) + e = e.to_f + t = t.to_f + t == 0 ? 0 : format("%.2f", e*100/t) + end + end diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 522b004a8..d3dc277bc 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -55,8 +55,8 @@
技术债务<%= @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"][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"] %>