1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-09 23:44:52 +00:00

Using eager loading in GenerateTournamentMatches and AdvanceWrestler, generating/manipulating in-memory, and doing a single bulk insert or update at the end.

This commit is contained in:
2026-02-24 20:58:36 -05:00
parent ca4d5ce0db
commit 18d39c6c8f
18 changed files with 904 additions and 521 deletions

View File

@@ -4,8 +4,6 @@ class PoolOrder
end
def getPoolOrder
# clear caching for weight for bracket page
@wrestlers.first.weight.touch
setOriginalPoints
while checkForTies(@wrestlers) == true
getWrestlersOrderByPoolAdvancePoints.each do |wrestler|
@@ -18,7 +16,6 @@ class PoolOrder
getWrestlersOrderByPoolAdvancePoints.each_with_index do |wrestler, index|
placement = index + 1
wrestler.pool_placement = placement
wrestler.save
end
@wrestlers.sort_by{|w| w.poolAdvancePoints}.reverse!
end
@@ -29,7 +26,6 @@ class PoolOrder
def setOriginalPoints
@wrestlers.each do |w|
matches = w.reload.all_matches
w.pool_placement_tiebreaker = nil
w.pool_placement = nil
w.poolAdvancePoints = w.pool_wins.size