Commit Graph

74 Commits

Author SHA1 Message Date
Cal Corum
4be6afb541 Add API timeout/retry logic and fix get_team_by_owner for PostgreSQL
- Add APITimeoutError exception and retry logic to db_get
- Add timeout handling to db_post, db_put, db_patch, db_delete
- Fix get_team_by_owner to prefer non-gauntlet team (PostgreSQL migration fix)
- Code formatting cleanup (black)
2026-01-31 15:52:14 -06:00
Cal Corum
5d841419b0 CLAUDE: Fix Event ID 9 gauntlet UnboundLocalError for team_id variable
When a gauntlet game ended for Event ID 9, the post_result function would crash with:
"UnboundLocalError: cannot access local variable 'team_id' where it is not associated with a value"

Event ID 9 was missing team_id initialization, while all other events (3,4,5,6,7,8)
properly set team_id. Added team_id = None to match the pattern used by Events 5, 6, and 8.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 12:57:12 -06:00
Cal Corum
e1f59cc49e CLAUDE: Fix Event ID 9 gauntlet rewards missing cardset assignment
Event ID 9 (Live 25) gauntlet rewards were being given without cardset_id
assigned, causing Team Choice packs to be unconfigured and unusable.

Root cause: Line 1923 checked if event ID was in [3, 4, 5, 6, 8], but
Event ID 9 was missing from this list. This caused the entire reward
assignment block (lines 1923-1957) including Event 9's cardset logic
(lines 1945-1948) to be skipped.

Event 9 should assign:
- cardset_id 27 for standard packs (2005 Live)
- cardset_id 26 for Promo Choice packs (pack_type_id 9)

Added 9 to the event ID list at line 1923 to enable proper cardset
assignment for Event 9 gauntlet rewards.

Fixes: Team Choice packs from Event 9 gauntlet missing cardset_id

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 16:01:46 -06:00
Cal Corum
1e75f1baba CLAUDE: Add news-ticker message when gauntlet runs end with 2 losses
Users reported that end-of-run messages to #pd-news-ticker were no longer
appearing when gauntlet teams lost their second game. The news-ticker
announcement was only happening for 10-win completions, not 2-loss endings.

Changes:
- Updated end_run() to accept bot and main_team parameters
- Added send_to_channel() call when losses == 2 (natural run end)
- Skips news-ticker for manual resets (force_end=True)
- Updated post_result() to pass bot and main_team to end_run()
- Updated manual reset calls to explicitly pass force_end=True

Now when a gauntlet team loses their second game, #pd-news-ticker will
show: "The **[Team]** have completed their **[Event]** Gauntlet run
with a final record of [wins]-[losses]."

The draft completion message to news-ticker was already working correctly
at cogs/players_new/gauntlet.py:178-183.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 09:17:55 -06:00
Cal Corum
c043948238 CLAUDE: Fix gauntlet game creation and Event 9 issues
Multiple fixes to resolve PlayNotFoundException and lineup initialization errors:

1. gauntlets.py:
   - Fixed Team object subscriptable errors (use .id instead of ['id'])
   - Added fallback cardsets (24, 25, 26) for Event 9 RP shortage
   - Fixed draft_team type handling (can be Team object or dict)

2. cogs/gameplay.py:
   - Fixed gauntlet game creation flow to read field player lineup from sheets
   - Catches LineupsMissingException when SP not yet selected
   - Instructs user to run /gamestate after SP selection

3. utilities/dropdown.py:
   - Fixed SelectStartingPitcher to create own session instead of using closed session
   - Store game/team IDs instead of objects to avoid detached session issues
   - Added exception handling for failed legality check API calls

These changes fix the issue where gauntlet games would fail to initialize
because the SP lineup entry wasn't being committed to the database.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 18:56:38 -06:00
Cal Corum
07195f9ad3 CLAUDE: Add Event ID 9 (Live 25) gauntlet configuration
Fixed missing draft configuration for Event ID 9 "Live 25" gauntlet that was causing crashes when users tried to start a gauntlet run.

Changes:
- Added cardset configuration for Event 9 (cardsets 27, 28, 29)
- Added Event 9 to max_counts progressive difficulty logic
- Added Event 9 to draft_loop() events list
- Opponent configuration for Event 9 was already present

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 13:03:41 -06:00
Cal Corum
904dae9a47 Gauntlet Pack Type Update 2025-11-09 06:34:14 -06:00
Cal Corum
0e3b98eb65 S10 Updates + PR Bugfix 2025-11-09 06:12:46 -06:00
Cal Corum
3debfd6e82 Catchup commit
Includes discord_ui refactor, testing overhaul, addition of
2025-07-22 09:22:19 -05:00
Cal Corum
dd23d3657a Team Choice pack bug - not including cardset 2025-06-04 22:30:41 -05:00
Cal Corum
65abc8ed55 Remove outdate image links
Add S3 image links
Pull all fielding ratings at game start
2025-06-04 09:54:13 -05:00
Cal Corum
6adf6e34b1 Gauntlet 8 team updates 2025-05-30 21:15:41 -05:00
Cal Corum
e366564bef Adding gauntlet 8
Season 9 updates
Uncapped runs scored bug fixed
2025-05-29 21:54:16 -05:00
Cal Corum
479a335373 Gauntlet evolution fix 2025-02-09 21:38:19 -06:00
Cal Corum
db52625899 Day 1 Gauntlet Updates
Baserunner advancement bug fixes
Pitcher sub bug fixes
2025-02-06 10:00:56 -06:00
Cal Corum
965ceebd35 Add responders check to dropdowns
Add colors and insults to helpers
Finish /set commands with helpers post /new-game
Add POW check for pitchers
2024-12-27 22:33:25 -06:00
Cal Corum
724b8922f2 Update gauntlet get SP for new objects
Handle gamestates without full lineups
Added /set command for lineup and SP
Fixed uncapped hit bugs
Added league_name property to Games
Fix get_team for gauntlets
Fixed SelectSP dropdown bug
2024-12-27 16:12:25 -06:00
Cal Corum
3db25b177a Refactor new game checks
Trail batter-runner on uncapped hits
2024-12-26 14:36:04 -06:00
Cal Corum
a4bce3cbce Wipe cards on reset run 2024-12-26 12:13:43 -06:00
Cal Corum
fddb06b2fe Mege cleanup 2024-12-24 16:10:44 -06:00
Cal Corum
19cdf969d1 Merge branch 'master' into sqlmodel-alembic-pytests-rebuild 2024-12-24 14:51:59 -06:00
Cal Corum
9ea6829674 Day 1 Pokemon updates 2024-12-24 14:21:33 -06:00
Cal Corum
5f8a422c2c Added Brilliant Stars gauntlet 2024-12-24 00:22:30 -06:00
Cal Corum
f9ced5cb9e Update gauntlet methods for Team objects 2024-12-18 10:00:26 -06:00
Cal Corum
d7a766029e Week 2 Gauntlet 2024-11-10 19:52:07 -06:00
Cal Corum
bfd72ae0f5 Update logging to RotatingFileHandler
Add auto game end
Calculate stats and decisions
Support raising instantiated exceptions
2024-11-09 23:14:54 -06:00
Cal Corum
8da859b63a Merge branch 'master' into sqlmodel-alembic-pytests-rebuild 2024-11-03 18:20:01 -06:00
Cal Corum
d02e973499 Prod push for Season 8 Updates 2024-11-03 13:38:41 -06:00
Cal Corum
b2a2f24cc1 Update owner sync
Set 1998 gauntlet opponents
2024-11-03 01:07:22 -06:00
Cal Corum
7dfd077b94 Season 8 Updates 2024-11-02 19:47:54 -05:00
Cal Corum
512efe98c4 db_calls -> api_calls
gameplay_db -> gameplay_models
new-game campaign in progress
added Player model
2024-10-12 18:22:13 -05:00
Cal Corum
fee00ce036 Fix one-loss gauntlet end bug 2024-10-11 08:44:51 -05:00
Cal Corum
d50595d49a Added /gauntlets reset 2024-07-26 16:54:23 -05:00
Cal Corum
76e990390b Live Series Gauntlet update 2024-07-03 09:55:30 -05:00
Cal Corum
93075519a3 Update gauntlets.py 2024-06-27 00:32:04 -05:00
Cal Corum
cf173d42dc Update gauntlets.py 2024-05-24 22:02:12 -05:00
Cal Corum
f7934d464f Refactoring gameplay AI / Automate subs 2024-05-19 02:12:35 -05:00
Cal Corum
3127bf2df8 Add support for 2024 Live gauntlet 2024-05-13 15:36:10 -05:00
Cal Corum
b8f626c261 Update gauntlets.py
Add team_id to team choice packs
2024-03-09 20:37:15 -06:00
Cal Corum
04201be18c Fix notifications and SUC gauntlet 2024-03-08 11:14:05 -06:00
Cal Corum
f65ec66724 Added Backyard Baseball Gauntlet 2024-03-08 00:47:58 -06:00
Cal Corum
101ef99435 Include Promos in '18 Gauntlet 2024-02-24 20:11:17 -06:00
Cal Corum
e8aee79af8 Update gauntlets.py
Add custom ballplayers to gauntlet draft
2023-12-21 00:10:00 -06:00
Cal Corum
c608453b07 Update gauntlets.py
Update gauntlet teams
2023-11-27 10:31:57 -06:00
Cal Corum
e46955a16d Bug fixes
Fixed end of gauntlet ping bug
Fixed "too many dupes" bug
2023-10-28 10:58:43 -05:00
Cal Corum
e0ef5616bd Day 1 Updates 2023-10-24 09:48:46 -05:00
Cal Corum
96f783bb63 2018 gauntlet in place 2023-10-23 00:58:10 -05:00
Cal Corum
72d6129b17 Player description update & bugfixes
Fixed trail runners not advancing for uncapped doubles and steals of home
2023-10-21 15:30:14 -05:00
Cal Corum
4031767f82 Command -> app_command completion 2023-09-11 15:00:02 -05:00
Cal Corum
edc6839b76 Flashback Gauntlet Team Update 2023-07-14 15:04:59 -05:00