|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
class QuestionBanksController < ApplicationController
|
|
|
|
|
before_action :require_login, :check_auth
|
|
|
|
|
before_action :params_filter
|
|
|
|
|
before_action :params_filter, except: [:my_courses]
|
|
|
|
|
|
|
|
|
|
# 题库选用列表
|
|
|
|
|
# object_type: # normal 普通作业题库; group 分组作业题库; poll问卷题库; exercise试卷题库; gtask 毕设选题题库;gtopic 毕设任务
|
|
|
|
@ -79,6 +79,30 @@ class QuestionBanksController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def my_courses
|
|
|
|
|
@courses = current_user.manage_courses.where(is_delete: 0, is_end: 0)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def send_to_course
|
|
|
|
|
bank = current_bank
|
|
|
|
|
course = current_user.manage_courses.find_by(id: params[:course_id])
|
|
|
|
|
case @object_type
|
|
|
|
|
when 'HomeworkBank' # 作业
|
|
|
|
|
quote_homework_bank bank, course
|
|
|
|
|
when 'ExerciseBank'
|
|
|
|
|
if bank.container_type == 'Exercise' # 试卷
|
|
|
|
|
quote_exercise_bank bank, course
|
|
|
|
|
else # 问卷
|
|
|
|
|
quote_poll_bank bank, course
|
|
|
|
|
end
|
|
|
|
|
when 'GtaskBank'
|
|
|
|
|
quote_gtask_bank bank, course
|
|
|
|
|
when 'GtopicBank'
|
|
|
|
|
quote_gtopic_bank bank, course
|
|
|
|
|
end
|
|
|
|
|
normal_status("发送成功")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
|
bank = current_bank
|
|
|
|
|
|
|
|
|
|