From a3c7087a486dd0bb23f18b35753c7f4098ba63fa Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 12 Mar 2019 21:13:13 +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 | 33 ++++++++++++++++++++++-- app/controllers/ec_years_controller.rb | 5 ++++ config/routes.rb | 3 +++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/app/controllers/ec_courses_controller.rb b/app/controllers/ec_courses_controller.rb index 124d642c..3bd700a8 100644 --- a/app/controllers/ec_courses_controller.rb +++ b/app/controllers/ec_courses_controller.rb @@ -101,6 +101,16 @@ class EcCoursesController < ApplicationController end end + def ec_course_support_setting_data + respond_to do |format| + format.json { + course_targets = @ec_course.ec_course_targets.includes(:ec_graduation_subitems) + json_data = target_list_data(course_targets) + render :json => json_data + } + end + end + # 课程目标配置的更新操作() # /ec_courses/1/crud_targets def crud_targets @@ -432,8 +442,26 @@ class EcCoursesController < ApplicationController {score: 70, level: "中"}, {score: 60, level: "差"}] end - Rails.logger.info("222222222222222222222template_major: #{@template_major}") - Rails.logger.info("2222222222222222222222222is_manager: #{@is_manager}") + render :json => {levels: ls, is_manager: @is_manager} + } + end + 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} } end @@ -600,6 +628,7 @@ class EcCoursesController < ApplicationController end end + Rails.logger.info("111111111111111user_id: #{User.current.try(:id)}") Rails.logger.info("template_major: #{@template_major}") Rails.logger.info("is_manager: #{@is_manager}") diff --git a/app/controllers/ec_years_controller.rb b/app/controllers/ec_years_controller.rb index e07e8804..0a8a67a8 100644 --- a/app/controllers/ec_years_controller.rb +++ b/app/controllers/ec_years_controller.rb @@ -54,6 +54,11 @@ class EcYearsController < ApplicationController format.html { render "/common/index", :layout => false } + end + end + + def student_lists_data + respond_to do |format| format.json { template_file = EcTemplate.find_by_name "学生列表导入模板" if template_file.present? diff --git a/config/routes.rb b/config/routes.rb index f2594596..a4cb0a79 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -68,6 +68,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 post 'add_manager' delete 'delete_manager' get "ec_course_support_setting" + get "ec_course_support_setting_data" get "ec_course_reach_setting" get "evaluation_methods" match "search_courses", :via => [:get, :post] @@ -81,6 +82,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 post 'crud_targets' post 'crud_score_level' get 'score_level' + get 'score_level_data' end collection do get 'get_calculation_data' @@ -143,6 +145,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 resources :ec_years, :path => "academic_years" do member do get 'student_lists' + get 'student_lists_data' match 'import_students', :via => [:post] get 'training_objectives' get 'graduation_requirement'