|
|
@ -250,7 +250,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
challenge_settings = @homework.homework_challenge_settings
|
|
|
|
challenge_settings = @homework.homework_challenge_settings
|
|
|
|
myshixuns.find_each(batch_size: 100) do |myshixun|
|
|
|
|
myshixuns.find_each(batch_size: 100) do |myshixun|
|
|
|
|
work = student_works.select{|work| work.user_id == myshixun.user_id}.first
|
|
|
|
work = student_works.select{|work| work.user_id == myshixun.user_id}.first
|
|
|
|
if work && myshixun && (work.update_time.nil? || work.update_time < myshixun.updated_at)
|
|
|
|
if work && myshixun && (work.update_time.nil? || work.update_time < myshixun.games.pluck(:updated_at).max)
|
|
|
|
games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id))
|
|
|
|
games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id))
|
|
|
|
HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings
|
|
|
|
HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -271,7 +271,7 @@ class HomeworkCommonsController < ApplicationController
|
|
|
|
myshixun = Myshixun.find_by(shixun_id: params[:shixun_id], user_id: current_user.id)
|
|
|
|
myshixun = Myshixun.find_by(shixun_id: params[:shixun_id], user_id: current_user.id)
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
if work && myshixun && (work.update_time.nil? || work.update_time < myshixun.updated_at)
|
|
|
|
if work && myshixun && (work.update_time.nil? || work.update_time < myshixun.games.pluck(:updated_at).max)
|
|
|
|
challenge_settings = @homework.homework_challenge_settings
|
|
|
|
challenge_settings = @homework.homework_challenge_settings
|
|
|
|
games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id))
|
|
|
|
games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id))
|
|
|
|
HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings
|
|
|
|
HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings
|
|
|
|