Commit Graph

13 Commits

Author SHA1 Message Date
Cal Corum
2c3835c8ac Added SeasonPitchingStats 2025-08-26 00:17:57 -05:00
Cal Corum
54a1a407d0 CLAUDE: Season batting stats table and selective update system
Major database enhancement implementing fast-querying season batting stats:

Database Schema:
- Created seasonbattingstats table with composite primary key (player_id, season)
- All batting stats (counting + calculated): pa, ab, avg, obp, slg, ops, woba, etc.
- Proper foreign key constraints and performance indexes
- Production-ready SQL creation script included

Selective Update System:
- update_season_batting_stats() function with PostgreSQL upsert logic
- Triggers on game PATCH operations to update affected player stats
- Recalculates complete season stats from stratplay data
- Efficient updates of only players who participated in modified games

API Enhancements:
- Enhanced SeasonBattingStats.get_top_hitters() with full filtering support
- New /api/v3/views/season-stats/batting/refresh endpoint for season rebuilds
- Updated views endpoint to use centralized get_top_hitters() method
- Support for team, player, min PA, and pagination filtering

Infrastructure:
- Production database sync Docker service with SSH automation
- Comprehensive error handling and logging throughout
- Fixed Peewee model to match actual table structure (no auto-id)
- Updated CLAUDE.md with dev server info and sync commands

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-23 22:18:27 -05:00
Cal Corum
c05d00d60e DB Error Handling
Added error handling wrapper and fixed SQLite -> Postgres issues
2025-08-20 19:33:40 -05:00
Cal Corum
cd1321553e Logging updates 2024-12-16 09:03:23 -06:00
Cal Corum
4380c26319 Add Swagger support 2024-07-14 13:23:37 -05:00
Cal Corum
fae1439365 Season 9 Additions 2024-01-14 22:44:23 -06:00
Cal Corum
85c8b441fa Update standings calculations 2023-08-11 09:32:35 -05:00
Cal Corum
505d0a1a8a Add divisions, update standings 2023-08-05 00:28:00 -05:00
Cal Corum
302d3fe3ac add game_id param to decisions 2023-07-31 23:02:13 -05:00
Cal Corum
cc3ff1d071 Add managers to /games 2023-07-31 00:29:04 -05:00
Cal Corum
2d235eb6f0 add /wipe/game 2023-07-29 01:35:39 -05:00
Cal Corum
5a5146c1cf Added logging to each router 2023-07-26 14:06:21 -05:00
Cal Corum
dd027f7fa0 Added /games 2023-07-25 00:19:33 -05:00