|
|
|
@ -139,7 +139,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
@student_works = []
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
unless @student_works.blank?
|
|
|
|
|
if @student_works.size > 0
|
|
|
|
|
# 教师评阅搜索 0: 未评, 1 已评
|
|
|
|
|
unless params[:teacher_comment].blank?
|
|
|
|
|
student_work_ids = StudentWorksScore.where(student_work_id: @student_works.map(&:id)).pluck(:student_work_id)
|
|
|
|
@ -169,6 +169,8 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
or student_id like ?", "%#{params[:search]}%", "%#{params[:search]}%")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@work_count = @student_works.size
|
|
|
|
|
|
|
|
|
|
# 排序
|
|
|
|
|
rorder = params[:order].blank? ? "update_time" : params[:order]
|
|
|
|
|
b_order = params[:b_order].blank? ? "desc" : params[:b_order]
|
|
|
|
@ -178,23 +180,22 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
@student_works = @student_works.joins(user: :user_extension).order("user_extensions.#{rorder} #{b_order}")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@work_count = @student_works.size
|
|
|
|
|
@work_excel = @student_works.includes(:student_works_scores, user: :user_extension, myshixun: :games)
|
|
|
|
|
@students = @course.students
|
|
|
|
|
@work_excel = @student_works
|
|
|
|
|
|
|
|
|
|
# 分页参数
|
|
|
|
|
page = params[:page] || 1
|
|
|
|
|
limit = params[:limit] || 20
|
|
|
|
|
@student_works = @student_works.page(page).per(limit)
|
|
|
|
|
@students = @course.students.where(user_id: @student_works.pluck(:user_id)).preload(:course_group)
|
|
|
|
|
if @homework.homework_type == "practice"
|
|
|
|
|
@student_works = @student_works.includes(:student_works_scores, user: :user_extension, myshixun: :games)
|
|
|
|
|
else
|
|
|
|
|
@student_works = @student_works.includes(:student_works_scores, :project, user: :user_extension)
|
|
|
|
|
end
|
|
|
|
|
# @members = @course.students.where(user_id: @student_works.pluck(:user_id)).includes(:course_group)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if params[:format] == "xlsx"
|
|
|
|
|
@work_excel = @work_excel.includes(:student_works_scores, user: :user_extension, myshixun: :games)
|
|
|
|
|
complete_works = @work_excel.present? ? @work_excel.where("work_status > 0").size : 0
|
|
|
|
|
if @user_course_identity >= Course::STUDENT
|
|
|
|
|
tip_exception(403, "无权限操作")
|
|
|
|
|