From e40adab4806bd40dc3bca9adbb12ca8518f9b526 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 12 Mar 2019 21:25:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ec_courses_controller.rb | 28 ++++++++++-------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/app/controllers/ec_courses_controller.rb b/app/controllers/ec_courses_controller.rb index 3bd700a8..9a3d491d 100644 --- a/app/controllers/ec_courses_controller.rb +++ b/app/controllers/ec_courses_controller.rb @@ -448,23 +448,19 @@ class EcCoursesController < ApplicationController end def score_level_data - respond_to do |format| - format.json{ - levels = @ec_course.ec_score_levels - ls = [] - if levels.present? - levels.each do |l| - ls << {score: l.score, level: l.level} - end - else - ls = [{score: 90, level: "优"}, - {score: 80, level: "良"}, - {score: 70, level: "中"}, - {score: 60, level: "差"}] - end - render :json => {levels: ls, is_manager: @is_manager} - } + levels = @ec_course.ec_score_levels + ls = [] + if levels.present? + levels.each do |l| + ls << {score: l.score, level: l.level} + end + else + ls = [{score: 90, level: "优"}, + {score: 80, level: "良"}, + {score: 70, level: "中"}, + {score: 60, level: "差"}] end + render :json => {levels: ls, is_manager: @is_manager} end def crud_score_level