TUR-9: Alter match filter for playoff stage to how it probably was meant to be
This commit is contained in:
parent
3c038ee9c9
commit
ead6d4f475
|
|
@ -19,10 +19,8 @@ class MatchesController < ApplicationController
|
||||||
if upcoming_matches.nil?
|
if upcoming_matches.nil?
|
||||||
next_level = 0
|
next_level = 0
|
||||||
@tournament.stages.sort_by(&:level).reverse_each do |stage|
|
@tournament.stages.sort_by(&:level).reverse_each do |stage|
|
||||||
# matches in the playoffs are only generated after one of the parent matches are done, so the stages
|
# the following if equates to true if it finds a stage where all matches are of state `in_progress`
|
||||||
# which are currently not running are empty, the first empty stage that is found is directly after
|
if stage.matches.reject { |m| m.state == 'in_progress' }.nil?
|
||||||
# the currently running one, so we subtract 1 and call it a day
|
|
||||||
if stage.matches.nil?
|
|
||||||
next_level = stage.level - 1
|
next_level = stage.level - 1
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue