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
|
||||
|
||||
def teams
|
||||
return matches.map(&:teams).flatten.uniq unless matches.size.zero?
|
||||
|
||||
groups.map(&:teams).flatten.uniq unless groups.size.zero?
|
||||
if !matches.size.zero?
|
||||
matches.map(&:teams).flatten.uniq
|
||||
elsif !groups.size.zero?
|
||||
groups.map(&:teams).flatten.uniq
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue