diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index be622b919..52e1f5fd0 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -61,7 +61,7 @@ class AdminController < ApplicationController if params[:syllabus_id] && params[:course_id] course = Course.where("id = #{params[:course_id].to_i}").first unless course.nil? - course.update_attribute('syllabus_id', params[:syllabus_id].to_i) + course.update_column('syllabus_id', params[:syllabus_id].to_i) @flag = true end end @@ -124,11 +124,11 @@ class AdminController < ApplicationController end end - #修改课程名称 + #修改班级名称 def update_course_name @course = Course.where("id = #{params[:course_id].to_i}").first unless @course.nil? - @course.update_attribute("name", params[:name]) + @course.update_column("name", params[:name]) respond_to do |format| format.js end diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index 73672d11a..03ed7945a 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -114,7 +114,7 @@ class QualityAnalysisController < ApplicationController end end rescue => e - puts e + @message = e.message end respond_to do |format| if @current_build_status == "success" @@ -227,9 +227,6 @@ class QualityAnalysisController < ApplicationController end @ha.store(key,value) end - - issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read - @sonar_issues = JSON.parse(issue_date).first end rescue => e puts e diff --git a/app/helpers/quality_analysis_helper.rb b/app/helpers/quality_analysis_helper.rb index 2a7d350e7..5940dd255 100644 --- a/app/helpers/quality_analysis_helper.rb +++ b/app/helpers/quality_analysis_helper.rb @@ -3,16 +3,16 @@ module QualityAnalysisHelper def sqale_rating_status val arr = [] - if val < 5 + if val <= 5 arr << "很好" arr << "b_green2" - elsif val. > 5 && val < 10 + elsif val. > 5 && val <= 10 arr << "较好" arr << "b_slow_yellow" - elsif val > 10 && val < 20 + elsif val > 10 && val <= 20 arr << "中等" arr << "b_yellow" - elsif val > 20 && val < 50 + elsif val > 20 && val <= 50 arr << "较差" arr << "b_slow_red" elsif val > 20 @@ -23,10 +23,10 @@ module QualityAnalysisHelper def complexity_status val arr = [] - if val < 10 + if val <= 10 arr << "良好" arr << "b_green2" - elsif val > 10 && val < 15 + elsif val > 10 && val <= 15 arr << "较高" arr << "b_yellow" elsif val > 15 @@ -37,10 +37,10 @@ module QualityAnalysisHelper def duplicated_lines_density_status val arr = [] - if val < 30 + if val <= 30 arr << "良好" arr << "b_green2" - elsif val > 30 && val < 50 + elsif val > 30 && val <= 50 arr << "较高" arr << "b_yellow" elsif val > 50 @@ -51,10 +51,10 @@ module QualityAnalysisHelper def comment_lines_density_status val arr = [] - if val < 20 + if val <= 20 arr << "较低" arr << "b_yellow" - elsif val > 20 && val < 50 + elsif val > 20 && val <= 50 arr << "正常" arr << "b_green2" elsif val > 50 @@ -64,15 +64,15 @@ module QualityAnalysisHelper end def score_sqale_rating val - if val > 0 && val < 5 + if val >= 0 && val <= 5 "5" - elsif val > 5 && val < 10 + elsif val > 5 && val <= 10 "4" - elsif val > 10 && val < 20 + elsif val > 10 && val <= 20 "3" - elsif val > 20 && val < 50 + elsif val > 20 && val <= 50 "2" - elsif val > 20 + elsif val > 50 "1" end end diff --git a/app/views/admin/_courselist_detail_tr.html.erb b/app/views/admin/_courselist_detail_tr.html.erb index bc1eebeed..83b7904ce 100644 --- a/app/views/admin/_courselist_detail_tr.html.erb +++ b/app/views/admin/_courselist_detail_tr.html.erb @@ -17,7 +17,8 @@ <%= course.is_delete == 0 ? '正常' : '归档' %> - + + <%= format_date(course.created_at) %> diff --git a/app/views/admin/non_syllabus_courses.html.erb b/app/views/admin/non_syllabus_courses.html.erb index 6cde56675..1be979eeb 100644 --- a/app/views/admin/non_syllabus_courses.html.erb +++ b/app/views/admin/non_syllabus_courses.html.erb @@ -27,10 +27,10 @@ - - + @@ -63,7 +66,7 @@ - + diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb index b0b8abafe..3e2a7d373 100644 --- a/app/views/quality_analysis/_result_list.html.erb +++ b/app/views/quality_analysis/_result_list.html.erb @@ -17,10 +17,10 @@ <% if @quality_analyses.count >0 %> <% @quality_analyses.each do |qa| %>
+ 序号 + 班级 @@ -42,6 +42,9 @@ <%=l(:field_is_public)%> + 状态 + <%=l(:field_created_on)%> <%= course.id %> + <%= course.name%> @@ -77,6 +80,9 @@ <%= checked_image course.is_public? %> + <%= course.is_delete == 0 ? '正常' : '归档' %> + <%= format_date(course.created_at) %>