From 02e5079e689046cb86e891c8c2c065ded73de506 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 11 Mar 2020 18:02:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=80=89=E7=94=A8=E9=A2=98?= =?UTF-8?q?=E5=BA=93=E5=92=8C=E5=88=9B=E5=BB=BA=E5=A2=9E=E5=8A=A0=E5=AD=90?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 5 +++++ app/controllers/question_banks_controller.rb | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 6c5230013..6140728c7 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -376,6 +376,11 @@ class HomeworkCommonsController < ApplicationController @homework.user_id = current_user.id @homework.course_id = @course.id + if params[:category].present? + category = @course.course_second_categories.find_by(id: params[:category]) + @homework.course_second_category_id = category&.id.to_i + end + homework_detail_manual = HomeworkDetailManual.new @homework.homework_detail_manual = homework_detail_manual homework_detail_manual.te_proportion = 0.7 diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index bcb88ad85..af6305a64 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -212,6 +212,11 @@ class QuestionBanksController < ApplicationController homework_type: homework.homework_type, course_id: course.id, homework_bank_id: homework.id, reference_answer: homework.reference_answer) + if params[:category].present? + category = course.course_second_categories.find_by(id: params[:category]) + new_homework.course_second_category_id = category&.id.to_i + end + # 作业的基本设置复制 new_homework.homework_detail_manual = HomeworkDetailManual.new new_homework_detail_manual = new_homework.homework_detail_manual