dev_aliyun_beta
cxt 6 years ago
parent 32d72e243c
commit 87a53a5560

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

Loading…
Cancel
Save