Annotate advancing teams that advance from group stage
This commit is contained in:
parent
dd520089ec
commit
963812cb0c
|
|
@ -4,9 +4,19 @@ class TournamentSerializer < SimpleTournamentSerializer
|
||||||
attributes :description, :playoff_teams_amount,
|
attributes :description, :playoff_teams_amount,
|
||||||
:instant_finalists_amount, :intermediate_round_participants_amount
|
:instant_finalists_amount, :intermediate_round_participants_amount
|
||||||
has_many :stages
|
has_many :stages
|
||||||
has_many :teams
|
|
||||||
|
|
||||||
attribute :owner_username do
|
attribute :owner_username do
|
||||||
object.owner.username
|
object.owner.username
|
||||||
end
|
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
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue