Merge pull request 'fix: correct column references in season pitching stats SQL' (#105) from fix/pitching-stats-column-name into main
All checks were successful
Build Docker Image / build (push) Successful in 2m11s
All checks were successful
Build Docker Image / build (push) Successful in 2m11s
This commit is contained in:
commit
d809590f0e
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user