socialforge/app/helpers/quality_analysis_helper.rb

72 lines
1.3 KiB
Ruby
Raw Normal View History

2016-06-21 16:50:45 +08:00
module QualityAnalysisHelper
2016-06-23 18:24:22 +08:00
def sqale_rating_status val
if val.to_i > 0 && val.to_i < 5
2016-06-24 10:05:49 +08:00
"很好"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 5 && val.to_i < 10
2016-06-24 10:05:49 +08:00
"较好"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 10 && val.to_i < 20
2016-06-24 10:05:49 +08:00
"中等"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 20 && val.to_i < 50
2016-06-24 10:05:49 +08:00
"较差"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 20
2016-06-24 10:05:49 +08:00
"很差"
2016-06-23 18:24:22 +08:00
end
end
def complexity_status val
if val.to_i < 10
2016-06-24 10:05:49 +08:00
"良好"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 10 && val.to_i < 15
2016-06-24 10:05:49 +08:00
"较高"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 15
2016-06-24 10:05:49 +08:00
"很高"
2016-06-23 18:24:22 +08:00
end
end
def duplicated_lines_density_status val
if val.to_i < 30
2016-06-24 10:05:49 +08:00
"良好"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 30 && val.to_i < 50
2016-06-24 10:05:49 +08:00
"较高"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 50
2016-06-24 10:05:49 +08:00
"很高"
2016-06-23 18:24:22 +08:00
end
end
def comment_lines_density_status val
if val.to_i < 20
2016-06-24 10:05:49 +08:00
"较低"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 20 && val.to_i < 50
2016-06-24 10:05:49 +08:00
"正常"
2016-06-23 18:24:22 +08:00
elsif val.to_i > 50
2016-06-24 10:05:49 +08:00
"较高"
2016-06-23 18:24:22 +08:00
end
end
2016-06-24 09:58:51 +08:00
def score_sqale_rating val
if val.to_i > 0 && val.to_i < 5
"5"
elsif val.to_i > 5 && val.to_i < 10
"4"
elsif val.to_i > 10 && val.to_i < 20
"3"
elsif val.to_i > 20 && val.to_i < 50
"2"
elsif val.to_i > 20
"1"
end
end
def lines_scale val
if val.to_i < 5000
2016-06-24 10:05:49 +08:00
"小型"
2016-06-24 09:58:51 +08:00
elsif val.to_i >5000 && val.to_i < 50000
2016-06-24 10:05:49 +08:00
"中型"
2016-06-24 09:58:51 +08:00
else
2016-06-24 10:05:49 +08:00
"大型"
2016-06-24 09:58:51 +08:00
end
end
2016-06-21 16:50:45 +08:00
end