Fix Stage.teams returning nil on error
This commit is contained in:
parent
1690755c4f
commit
894608c19e
|
|
@ -8,8 +8,12 @@ class Stage < ApplicationRecord
|
||||||
delegate :owner, to: :tournament
|
delegate :owner, to: :tournament
|
||||||
|
|
||||||
def teams
|
def teams
|
||||||
return matches.map(&:teams).flatten.uniq unless matches.size.zero?
|
if !matches.size.zero?
|
||||||
|
matches.map(&:teams).flatten.uniq
|
||||||
groups.map(&:teams).flatten.uniq unless groups.size.zero?
|
elsif !groups.size.zero?
|
||||||
|
groups.map(&:teams).flatten.uniq
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue