1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Refactored match winner and wrestlers matches and fixed slow tests.

This commit is contained in:
2025-04-25 15:59:35 -04:00
parent 3e4317dbc5
commit 1fcaec876f
20 changed files with 147 additions and 116 deletions

View File

@@ -14,9 +14,9 @@ class ApiController < ApplicationController
end
def tournament
@tournament = Tournament.where(:id => params[:tournament]).includes(:schools,:weights,:mats,:matches,:user,:wrestlers).first
@schools = @tournament.schools.includes(:wrestlers)
@weights = @tournament.weights.includes(:wrestlers)
@tournament = Tournament.where(:id => params[:tournament]).includes(:user, :mats, :schools, :weights, :matches, wrestlers: [:school, :weight, :matches_as_w1, :matches_as_w2]).first
@schools = @tournament.schools.includes(wrestlers: [:weight, :matches_as_w1, :matches_as_w2])
@weights = @tournament.weights.includes(wrestlers: [:school, :matches_as_w1, :matches_as_w2])
@matches = @tournament.matches.includes(:wrestlers,:schools)
@mats = @tournament.mats.includes(:matches)
end