Skip to content

bug: fix tournament match substitute lineups#266

Open
zeeshaun wants to merge 3 commits into
5stackgg:mainfrom
zeeshaun:fix/tournament-substitute-match-lineups
Open

bug: fix tournament match substitute lineups#266
zeeshaun wants to merge 3 commits into
5stackgg:mainfrom
zeeshaun:fix/tournament-substitute-match-lineups

Conversation

@zeeshaun
Copy link
Copy Markdown

@zeeshaun zeeshaun commented May 31, 2026

Fixes 5stackgg/5stack-panel#485

Before fix test script: issue-485-before-fix-test.sql

NOTICE:  Scheduling match for bracket 34bf9417-6822-4dad-8c4f-3c972ab28061
UPDATE 1
UPDATE 1
ERROR:  Max number of players reached
CONTEXT:  PL/pgSQL function check_match_lineup_players_count(match_lineup_players) line 21 at RAISE
SQL statement "select check_match_lineup_players_count(NEW)"
PL/pgSQL function tbid_match_lineup_players() line 39 at SQL statement
UPDATE 1
       step       |              lineup_id               | player_count
------------------+--------------------------------------+--------------
 after scheduling | 1dd0620f-778a-4946-8c03-bc4451e14b15 |            6
 after scheduling | 26bed0c9-f396-4f9d-9e0e-e79f01259626 |            6
(2 rows)

command terminated with exit code 3

After fix test script: issue-485-test.sql

       step       |              lineup_id               | player_count 
------------------+--------------------------------------+--------------
 after scheduling | 6194014e-5d84-4ac8-9af0-2d6f76b400cc |            5
 after scheduling | 895787c4-05fb-4948-a3ff-9948117c1eac |            5
(2 rows)

INSERT 0 1
          step           |              lineup_id               | player_count 
-------------------------+--------------------------------------+--------------
 after adding substitute | 6194014e-5d84-4ac8-9af0-2d6f76b400cc |            5
 after adding substitute | 895787c4-05fb-4948-a3ff-9948117c1eac |            6
(2 rows

Before fix:
Before fix

After fix:
After fix

@lukepolo lukepolo changed the title Fix tournament match substitute lineups bug: fix tournament match substitute lineups Jun 1, 2026
@lukepolo
Copy link
Copy Markdown
Contributor

lukepolo commented Jun 1, 2026

we should be using tournament_max_players_per_lineup as the limit not the min. im acutaly surpised the minw orked for you as that should had only grabbed 5

@zeeshaun
Copy link
Copy Markdown
Author

zeeshaun commented Jun 1, 2026

I swapped to use tournament_max_players_per_lineup as the limit.

Using max

My test appeared to work because of how my test script was generating the test case.

Revised script:
issue-485-test.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Error 'Max number of players reached' when finishing a match in a tournament with a substitute set

2 participants