|
|
|
@ -22,8 +22,8 @@ class Users::QuestionBankService
|
|
|
|
|
course_lists = CourseList.joins(relation_name).where.not(relation_name => { id: nil })
|
|
|
|
|
|
|
|
|
|
category_condition =
|
|
|
|
|
case params[:category]
|
|
|
|
|
when 'common' then { homework_type: 1 }
|
|
|
|
|
case params[:object_type]
|
|
|
|
|
when 'normal' then { homework_type: 1 }
|
|
|
|
|
when 'group' then { homework_type: 3 }
|
|
|
|
|
when 'exercise' then { container_type: 'Exercise' }
|
|
|
|
|
when 'poll' then { container_type: 'Poll' }
|
|
|
|
@ -47,8 +47,8 @@ class Users::QuestionBankService
|
|
|
|
|
|
|
|
|
|
def class_name
|
|
|
|
|
@_class_name ||= begin
|
|
|
|
|
case params[:category]
|
|
|
|
|
when 'common', 'group' then 'HomeworkBank'
|
|
|
|
|
case params[:object_type]
|
|
|
|
|
when 'normal', 'group' then 'HomeworkBank'
|
|
|
|
|
when 'exercise', 'poll' then 'ExerciseBank'
|
|
|
|
|
when 'gtask' then 'GtaskBank'
|
|
|
|
|
when 'gtopic' then 'GtopicBank'
|
|
|
|
@ -58,8 +58,8 @@ class Users::QuestionBankService
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def category_filter(relations)
|
|
|
|
|
case params[:category]
|
|
|
|
|
when 'common' then
|
|
|
|
|
case params[:object_type]
|
|
|
|
|
when 'normal' then
|
|
|
|
|
relations.where(homework_type: 1)
|
|
|
|
|
when 'group' then
|
|
|
|
|
relations.where(homework_type: 3)
|
|
|
|
|