From 5786607b7fefc7a0e069d0990edd97390a141ec1 Mon Sep 17 00:00:00 2001 From: Malaber Date: Sun, 9 Mar 2025 20:04:00 +0100 Subject: [PATCH] Reload group_scores from database after update --- spec/services/group_stage_service_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/services/group_stage_service_spec.rb b/spec/services/group_stage_service_spec.rb index fb093d8..37d3e67 100644 --- a/spec/services/group_stage_service_spec.rb +++ b/spec/services/group_stage_service_spec.rb @@ -221,15 +221,17 @@ RSpec.describe GroupStageService do group.matches.each do |match| match.match_scores.each do |ms| # 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.save! end match.state = 'finished' match.save! end - gs = GroupStageService.update_group_scores(group) - gs.each(&:save!) + group_scores = GroupStageService.update_group_scores(group) + group_scores.each(&:save!) + + group.group_scores.each(&:reload) end end end