Skip to content

Commit

Permalink
Use result multiplier in the sum calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
just806me committed Sep 30, 2023
1 parent 0cc366d commit dc53e4f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/channels/api_channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit dc53e4f

Please sign in to comment.