diff --git a/app/channels/api_channel.rb b/app/channels/api_channel.rb index 1ef6b8b0..e4633ec3 100644 --- a/app/channels/api_channel.rb +++ b/app/channels/api_channel.rb @@ -155,11 +155,13 @@ def finish data users_without_result = [] begin + result_multiplier = Rational(task.result_multiplier) + ActiveRecord::Base.transaction do task.contest.users.find_each do |user| user_result = CriterionUserResult.where user:, criterion: task.criterions users_without_result << user.judge_secret unless user_result.count == task.criterions_count - score = user_result.sum :value + score = user_result.sum(:value) * result_multiplier Result.create_or_find_by!(user:, task:).update!(score:) end