From 2b745db4b4340f52c601cfe35ed41ac9b0cd1bf3 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 4 Jul 2019 09:26:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/homework_end_update_score_job.rb | 3 ++- app/jobs/poll_publish_notify_job.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/jobs/homework_end_update_score_job.rb b/app/jobs/homework_end_update_score_job.rb index e141fd758..649a5c37a 100644 --- a/app/jobs/homework_end_update_score_job.rb +++ b/app/jobs/homework_end_update_score_job.rb @@ -16,7 +16,8 @@ class HomeworkEndUpdateScoreJob < ApplicationJob student_works = homework.student_works.where(user_id: user_ids) end - myshixuns = Myshixun.where(shixun_id: params[:shixun_id], user_id: user_ids). + shixun_id = homework.homework_commons_shixun.try(:shixun_id) + myshixuns = Myshixun.where(shixun_id: shixun_id, user_id: user_ids). includes(:games).where(games: {challenge_id: homework.homework_challenge_settings.pluck(:challenge_id)}) challenge_settings = homework.homework_challenge_settings myshixuns.find_each(batch_size: 100) do |myshixun| diff --git a/app/jobs/poll_publish_notify_job.rb b/app/jobs/poll_publish_notify_job.rb index 89fb45ea5..52660abd1 100644 --- a/app/jobs/poll_publish_notify_job.rb +++ b/app/jobs/poll_publish_notify_job.rb @@ -31,7 +31,7 @@ class PollPublishNotifyJob < ApplicationJob Tiding.bulk_insert(*attrs) do |worker| teacher_ids = teachers.pluck(:user_id) unless poll.tidings.exists?(parent_container_type: 'PollPublish', user_id: teacher_ids) - teacher_ids.find_each do |user_id| + teacher_ids.each do |user_id| worker.add same_attrs.merge(user_id: user_id) end end