导出的调整

dev_forum
cxt 6 years ago
parent 54f7137886
commit e4a2a896e3

@ -170,6 +170,7 @@ class HomeworkCommonsController < ApplicationController
end
@work_count = @student_works.size
@work_excel = @student_works.where("work_status > 0")
# 排序
rorder = params[:order].blank? ? "update_time" : params[:order]
@ -180,8 +181,6 @@ class HomeworkCommonsController < ApplicationController
@student_works = @student_works.joins(user: :user_extension).order("user_extensions.#{rorder} #{b_order}")
end
@work_excel = @student_works
# 分页参数
page = params[:page] || 1
limit = params[:limit] || 20
@ -195,10 +194,9 @@ class HomeworkCommonsController < ApplicationController
end
if params[:format] == "xlsx"
complete_works = @work_excel.present? ? @work_excel.where("work_status > 0").size : 0
if @user_course_identity >= Course::STUDENT
tip_exception(403, "无权限操作")
elsif complete_works == 0
elsif @work_excel.size == 0
normal_status(-1,"暂无用户提交!")
else
respond_to do |format|

Loading…
Cancel
Save