1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-22 14:32:22 +00:00

Fixed a number of N+1 issues on low traffic pages. I also added relevant html tests for these pages.

This commit is contained in:
2026-02-17 22:27:11 -05:00
parent d359be3ea1
commit 8670ce38c3
16 changed files with 330 additions and 103 deletions

View File

@@ -97,18 +97,11 @@ class Tournament < ApplicationRecord
end
def pointAdjustments
point_adjustments = []
self.schools.each do |s|
s.deductedPoints.each do |d|
point_adjustments << d
end
end
self.wrestlers.each do |w|
w.deductedPoints.each do |d|
point_adjustments << d
end
end
point_adjustments
school_scope = Teampointadjust.where(school_id: schools.select(:id))
wrestler_scope = Teampointadjust.where(wrestler_id: wrestlers.select(:id))
Teampointadjust.includes(:school, :wrestler)
.merge(school_scope.or(wrestler_scope))
end
def remove_school_delegations