Reload group_scores from database after update

This commit is contained in:
Daniel Schädler 2025-03-09 20:04:00 +01:00
parent a74236982d
commit 5786607b7f
1 changed files with 5 additions and 3 deletions

View File

@ -221,15 +221,17 @@ RSpec.describe GroupStageService do
group.matches.each do |match| group.matches.each do |match|
match.match_scores.each do |ms| match.match_scores.each do |ms|
# give the team 10 points minus the number in their name # give the team 10 points minus the number in their name
# this results in the team 1 always winning and getting to place 1 in the group etc. # this results in the team 0 always winning and getting to place 1 in the group etc.
ms.points = 10 - ms.team.name.split(' ').last.to_i ms.points = 10 - ms.team.name.split(' ').last.to_i
ms.save! ms.save!
end end
match.state = 'finished' match.state = 'finished'
match.save! match.save!
end end
gs = GroupStageService.update_group_scores(group) group_scores = GroupStageService.update_group_scores(group)
gs.each(&:save!) group_scores.each(&:save!)
group.group_scores.each(&:reload)
end end
end end
end end