Commit Graph

24 Commits

Author SHA1 Message Date
Cal Corum
51004ea143 Fix bot crash when substituting player without eligible position
Bug: When a user attempted to substitute a player who didn't have the required
position rating, the bot would display an error message but leave the database
session in an inconsistent state. The old player was marked inactive and flushed
to the session, but when the position check failed, the function returned early
without rolling back the session. This left the session dirty, causing crashes
on subsequent operations.

Fix: Added session.rollback() before returning when PositionNotFoundException
is caught, ensuring the database session is cleanly reset.

Location: utilities/dropdown.py:479-480 in SelectBatterSub.callback()

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-12 16:02:35 -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
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
17680a2348 Added /substitution defense 2025-05-30 01:19:45 -05:00
Cal Corum
a416e90db9 New postion sub logic 2025-03-09 00:59:10 -06:00
Cal Corum
f8aad38739 Update cache refresh logic to replace vs delete 2025-02-23 22:50:58 -06:00
Cal Corum
557404301a Fix fatigue bugs 2025-02-11 00:58:45 -06:00
Cal Corum
479a335373 Gauntlet evolution fix 2025-02-09 21:38:19 -06:00
Cal Corum
d5f2978b01 Update new-game flow 2025-02-06 15:12:12 -06:00
Cal Corum
cd9d5e49d0 Add confirmation_message param to ask_with_buttons 2025-02-01 21:33:12 -06:00
Cal Corum
3273af6465 Helpers checks 2025-01-24 10:08:35 -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
f40347e0bb Fixed chaos button bug
Added batting statline to batter & OT to catchers
2024-12-25 16:10:24 -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
5f8a422c2c Added Brilliant Stars gauntlet 2024-12-24 00:22:30 -06:00
Cal Corum
7f6472bbc6 Batter subs plus cleanup 2024-12-23 10:09:11 -06:00
Cal Corum
d6d3d7beb0 Log stealing done
Log xchecks started
2024-11-25 13:17:51 -06:00
Cal Corum
073bd04b4b Added RosterLinks to remove card_id from setup process
Add SelectStartingPitcher dropdown
New .sync function
2024-11-23 19:53:48 -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
c3418c4dfd New show-card dropdown view
Added PlayInitException
Added complete_and_post_play for log commands
Added many more log plays
Add undo-play
Added query logging
2024-11-09 00:48:13 -06:00
Cal Corum
63e738d048 Added dropdowns to utilities 2024-10-14 01:37:30 -05:00