题库调整

dev_aliyun_beta
cxt 5 years ago
parent 0b897c8d57
commit d8c9163fa1

@ -57,8 +57,8 @@ class HomeworkBanksController < ApplicationController
tip_exception("description参数不能为空") if params[:homework_bank][:description].blank?
if @bank.homework_type == 3
tip_exception("base_on_project参数不能为空") if params[:homework_bank][:base_on_project].nil?
tip_exception("min_num参数不能为空") if params[:homework_bank][:min_num].blank?
tip_exception("max_num参数不能为空") if params[:homework_bank][:max_num].blank?
tip_exception("最小人数不能为空") if params[:homework_bank][:min_num].blank?
tip_exception("最大人数参数不能为空") if params[:homework_bank][:max_num].blank?
tip_exception("最小人数不能小于1") if params[:homework_bank][:min_num].to_i < 1
tip_exception("最大人数不能小于最小人数") if params[:homework_bank][:max_num].to_i < params[:homework_bank][:min_num].to_i
end

@ -85,7 +85,7 @@ class Users::QuestionBankService
def custom_sort(relations, sort_by, sort_direction)
case sort_by
when 'updated_at' then
relations.order("updated_at #{sort_direction}, id desc")
relations.order("updated_at #{sort_direction}, id #{sort_direction}")
when 'name' then
relations.order("CONVERT(name USING gbk) COLLATE gbk_chinese_ci #{sort_direction}")
when 'contributor' then

@ -1,6 +1,9 @@
json.count @count
json.course_list @course_lists, partial: 'users/question_banks/shared/course_list', as: :course_list
json.course_list @course_lists do |course_list|
json.id course_list.id
json.name course_list.name
end
json.question_banks @question_banks do |question_bank|
json.id question_bank.id

Loading…
Cancel
Save