|
|
|
@ -10,7 +10,7 @@ class QuestionBanksController < ApplicationController
|
|
|
|
|
def bank_list
|
|
|
|
|
page = params[:page] || 1
|
|
|
|
|
limit = params[:limit] || 15
|
|
|
|
|
@certification_teacher = current_user.is_teacher || current_user.admin?
|
|
|
|
|
@certification_teacher = current_user.is_teacher? || current_user.admin?
|
|
|
|
|
@objects = @object_type.classify.constantize.where(@object_filter)
|
|
|
|
|
@objects =
|
|
|
|
|
if params[:search]
|
|
|
|
@ -21,7 +21,7 @@ class QuestionBanksController < ApplicationController
|
|
|
|
|
#{@objects.table_name}.is_public = 1 and concat(#{@objects.table_name}.name, course_lists.name) like
|
|
|
|
|
'%#{params[:search]}%'
|
|
|
|
|
}
|
|
|
|
|
@objects.where(sql)
|
|
|
|
|
@objects.joins(:course_list).where(sql)
|
|
|
|
|
else
|
|
|
|
|
@objects.none
|
|
|
|
|
end
|
|
|
|
@ -30,7 +30,7 @@ class QuestionBanksController < ApplicationController
|
|
|
|
|
#{@objects.table_name}.user_id = #{current_user.id} and concat(#{@objects.table_name}.name, course_lists.name) like
|
|
|
|
|
'%#{params[:search]}%'
|
|
|
|
|
}
|
|
|
|
|
@objects.where(sql)
|
|
|
|
|
@objects.joins(:course_list).where(sql)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if params[:filter] == 'public'
|
|
|
|
|