From a64d6ef50214f8e29a3130edeba1dd84e7a504cd Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 11 Oct 2019 15:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=98=E5=BA=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/question_banks_controller.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index 60b9a807c..7781b5792 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -90,23 +90,25 @@ class QuestionBanksController < ApplicationController def send_to_course banks = @object_type.classify.constantize.where(id: params[:object_id]) course = current_user.manage_courses.find_by!(id: params[:course_id]) + task_ids = [] banks.each do |bank| case @object_type when 'HomeworkBank' # 作业 - quote_homework_bank bank, course + task = quote_homework_bank bank, course when 'ExerciseBank' if bank.container_type == 'Exercise' # 试卷 - quote_exercise_bank bank, course + task = quote_exercise_bank bank, course else # 问卷 - quote_poll_bank bank, course + task = quote_poll_bank bank, course end when 'GtaskBank' - quote_gtask_bank bank, course + task = quote_gtask_bank bank, course when 'GtopicBank' - quote_gtopic_bank bank, course + task = quote_gtopic_bank bank, course end + task_ids << task.id if task end - normal_status("发送成功") + render :json => {task_ids: task_ids, status: 0, message: "发送成功"} end def destroy