You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
686 B
21 lines
686 B
# 作业的一键评阅
|
|
class HomeworkBatchCommentJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform(comment, hidden_comment, work_ids, homework_id, user_id)
|
|
# Do something later
|
|
homework = HomeworkCommon.find_by(id: homework_id)
|
|
return if homework.blank?
|
|
|
|
attrs = %i[student_work_id challenge_id user_id comment hidden_comment batch_comment created_at updated_at]
|
|
|
|
same_attrs = {challenge_id: 0, user_id: user_id, comment: comment, hidden_comment: hidden_comment, batch_comment: 1}
|
|
|
|
ShixunWorkComment.bulk_insert(*attrs) do |worker|
|
|
work_ids.each do |work_id|
|
|
worker.add same_attrs.merge(student_work_id: work_id)
|
|
end
|
|
end
|
|
end
|
|
end
|