1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-24 17:04:43 +00:00

Fixed double elimination generate loser names for a 6 man bracket when we're placing top 8

This commit is contained in:
2026-01-23 17:35:16 -05:00
parent 86f9c03991
commit 556090c16b

View File

@@ -6,9 +6,12 @@ class DoubleEliminationGenerateLoserNames
# Entry point: assign loser placeholders and advance any byes
def assign_loser_names
@tournament.weights.each do |weight|
assign_loser_names_for_weight(weight)
advance_bye_matches_championship(weight)
advance_bye_matches_consolation(weight)
# only assign loser names if there's conso matches to be had
if weight.calculate_bracket_size > 2
assign_loser_names_for_weight(weight)
advance_bye_matches_championship(weight)
advance_bye_matches_consolation(weight)
end
end
end
@@ -87,7 +90,7 @@ class DoubleEliminationGenerateLoserNames
end
# 5th/6th place
if bracket_size >= 5 && num_placers >= 6
if bracket_size >= 5 && num_placers >= 6 && weight.wrestlers.size > 4
conso_semis = matches.select { |m| m.bracket_position == "Conso Semis" }
.sort_by(&:bracket_position_number)
if conso_semis.size >= 2
@@ -98,7 +101,7 @@ class DoubleEliminationGenerateLoserNames
end
# 7th/8th place
if bracket_size >= 7 && num_placers >= 8
if bracket_size >= 7 && num_placers >= 8 && weight.wrestlers.size > 6
conso_quarters = matches.select { |m| m.bracket_position == "Conso Quarter" }
.sort_by(&:bracket_position_number)
if conso_quarters.size >= 2