1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-08 23:34:51 +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

@@ -53,19 +53,16 @@ class User < ApplicationRecord
end
def delegated_tournaments
tournaments_delegated = []
delegated_tournament_permissions.each do |t|
tournaments_delegated << t.tournament
end
tournaments_delegated
Tournament.joins(:delegates)
.where(tournament_delegates: { user_id: id })
.distinct
end
def delegated_schools
schools_delegated = []
delegated_school_permissions.each do |t|
schools_delegated << t.school
end
schools_delegated
School.joins(:delegates)
.where(school_delegates: { user_id: id })
.includes(:tournament)
.distinct
end
def self.search(search)