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

Fixed the query for unassigned matches on the up_matches page and also only allow mats to get a new match assigned if they have less than 4 unfinished matches. Added mats to the finish_tournament_204 rake task.

This commit is contained in:
2025-01-10 16:02:37 -05:00
parent 38785924ed
commit e612a4b10e
3 changed files with 29 additions and 4 deletions

View File

@@ -191,9 +191,12 @@ class TournamentsController < ApplicationController
def up_matches
# .where.not(loser1_name: 'BYE') won't return matches with NULL loser1_name
# so I was only getting back matches with Loser of BOUT_NUMBER
@matches = @tournament.matches
.where("mat_id is NULL and (finished <> ? or finished is NULL)",1)
.where.not(loser1_name: "BYE").where.not(loser2_name: "BYE")
.where("mat_id is NULL and (finished != 1 or finished is NULL)")
.where("loser1_name != ? OR loser1_name IS NULL", "BYE")
.where("loser2_name != ? OR loser2_name IS NULL", "BYE")
.order('bout_number ASC')
.limit(10).includes(:wrestlers)
@mats = @tournament.mats.includes(:matches)