|
|
|
@ -1377,12 +1377,12 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
|
tip_exception(-1, "作业还未发布,不能评阅") if @homework_detail_manual.comment_status == 0
|
|
|
|
|
tip_exception("请至少输入一个评阅") if params[:comment].blank? && params[:hidden_comment].blank?
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
work_ids = @homework.student_works.where(user_id: @course.teacher_group_user_ids(current_user.id)).pluck(:id)
|
|
|
|
|
work_ids = @homework.student_works.where(work_status: [1, 2], user_id: @course.teacher_group_user_ids(current_user.id)).pluck(:id)
|
|
|
|
|
has_comment_ids = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 0).pluck(:student_work_id)
|
|
|
|
|
batch_comment_works = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 1)
|
|
|
|
|
batch_comment_works.update_all(comment: params[:comment], hidden_comment: params[:hidden_comment])
|
|
|
|
|
work_ids = work_ids - has_comment_ids - batch_comment_works.pluck(:student_work_id)
|
|
|
|
|
@homework.student_works.where(work_status: 0, id: work_ids).update_all(work_status: 1, commit_time: @homework.end_time, update_time: Time.now, work_score: 0, final_score: 0)
|
|
|
|
|
# @homework.student_works.where(work_status: 0, id: work_ids).update_all(work_status: 1, commit_time: @homework.end_time, update_time: Time.now, work_score: 0, final_score: 0)
|
|
|
|
|
HomeworkBatchCommentJob.perform_later(params[:comment], params[:hidden_comment], work_ids, @homework.id, current_user.id)
|
|
|
|
|
normal_status("评阅成功")
|
|
|
|
|
end
|
|
|
|
|