mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-14 17:06:46 +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:
@@ -96,7 +96,9 @@ class Mat < ApplicationRecord
|
||||
@queue_matches = if ids.empty?
|
||||
[nil, nil, nil, nil]
|
||||
else
|
||||
matches_by_id = Match.where(id: ids).index_by(&:id)
|
||||
matches_by_id = Match.where(id: ids)
|
||||
.includes({ wrestler1: :school }, { wrestler2: :school }, { weight: :matches })
|
||||
.index_by(&:id)
|
||||
slot_ids.map { |match_id| match_id ? matches_by_id[match_id] : nil }
|
||||
end
|
||||
@queue_match_slot_ids = slot_ids
|
||||
|
||||
Reference in New Issue
Block a user