From bd19b7d913d973cb042ac2b1cc036eedaa77df60 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 2 Apr 2026 11:54:56 -0500 Subject: [PATCH] fix: correct column references in season pitching stats view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sp.on_first/on_second/on_third don't exist — the actual columns are on_first_id/on_second_id/on_third_id. This caused failures when updating season pitching stats after games. Co-Authored-By: Claude Opus 4.6 (1M context) --- app/dependencies.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/dependencies.py b/app/dependencies.py index bfab9f1..78ebc58 100644 --- a/app/dependencies.py +++ b/app/dependencies.py @@ -379,14 +379,14 @@ def update_season_pitching_stats(player_ids, season, db_connection): -- RBI allowed (excluding HR) per runner opportunity CASE - WHEN (SUM(CASE WHEN sp.on_first IS NOT NULL THEN 1 ELSE 0 END) + - SUM(CASE WHEN sp.on_second IS NOT NULL THEN 1 ELSE 0 END) + - SUM(CASE WHEN sp.on_third IS NOT NULL THEN 1 ELSE 0 END)) > 0 + WHEN (SUM(CASE WHEN sp.on_first_id IS NOT NULL THEN 1 ELSE 0 END) + + SUM(CASE WHEN sp.on_second_id IS NOT NULL THEN 1 ELSE 0 END) + + SUM(CASE WHEN sp.on_third_id IS NOT NULL THEN 1 ELSE 0 END)) > 0 THEN ROUND( (SUM(sp.rbi) - SUM(sp.homerun))::DECIMAL / - (SUM(CASE WHEN sp.on_first IS NOT NULL THEN 1 ELSE 0 END) + - SUM(CASE WHEN sp.on_second IS NOT NULL THEN 1 ELSE 0 END) + - SUM(CASE WHEN sp.on_third IS NOT NULL THEN 1 ELSE 0 END)), + (SUM(CASE WHEN sp.on_first_id IS NOT NULL THEN 1 ELSE 0 END) + + SUM(CASE WHEN sp.on_second_id IS NOT NULL THEN 1 ELSE 0 END) + + SUM(CASE WHEN sp.on_third_id IS NOT NULL THEN 1 ELSE 0 END)), 3 ) ELSE 0.000 -- 2.25.1