Skip to content

Commit

Permalink
turnir
Browse files Browse the repository at this point in the history
  • Loading branch information
mytja committed Jan 21, 2024
1 parent 579c865 commit 863ea1c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions backend/internal/tournament/goroutine.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,18 @@ func (s *tournamentImpl) CalculateRating() {
}

func (s *tournamentImpl) EndTournament() {
s.CalculateRating()
s.logger.Debugw("rating calculated. now awaiting game ends.")
tournament, err := s.db.GetTournament(s.tournamentId)
if err != nil {
s.logger.Errorw("tournament fetching failed", "err", err)
return
}

if tournament.Rated {
s.CalculateRating()
s.logger.Debugw("rating calculated")
}

s.logger.Debugw("awaiting game ends")
time.Sleep(1 * time.Second)
for i := range s.games {
s.wsServer.EndGame(i)
Expand Down

0 comments on commit 863ea1c

Please sign in to comment.