Annotate advancing teams that advance from group stage

This commit is contained in:
Daniel Schädler 2025-03-14 13:23:10 +01:00
parent dd520089ec
commit 963812cb0c
1 changed files with 11 additions and 1 deletions

View File

@ -4,9 +4,19 @@ class TournamentSerializer < SimpleTournamentSerializer
attributes :description, :playoff_teams_amount,
:instant_finalists_amount, :intermediate_round_participants_amount
has_many :stages
has_many :teams
attribute :owner_username do
object.owner.username
end
attribute :teams do
adv_teams = object.group_stage ? GroupStageService.get_advancing_teams(object.group_stage) : []
object.teams.map do |team|
{
id: team.id,
name: team.name,
advancing_from_group_stage: adv_teams.include?(team)
}
end
end
end