X-Check and BP-SI cleanup

This commit is contained in:
Cal Corum 2023-10-27 20:13:58 -05:00
parent 1a9f15b489
commit 7a5dd257ef

View File

@ -63,7 +63,7 @@ class PlayResult(pydantic.BaseModel):
@validator("is_offense", always=True)
def offense_validator(cls, v, values, **kwargs):
return values['short_name'][:2] in ['HR', 'TR', 'DO', 'SI', 'WA', 'HB', '◆B']
return values['short_name'][:2] in ['HR', 'TR', 'DO', 'SI', 'WA', 'HB', '◆B', '▼B']
PLAY_RESULTS = {
@ -78,7 +78,7 @@ PLAY_RESULTS = {
'si**': PlayResult(full_name='SINGLE**', short_name='SI**'),
'si*': PlayResult(full_name='SINGLE*', short_name='SI*'),
'si-cf': PlayResult(full_name='SINGLE (cf)', short_name='SI (cf)'),
'bp-si': PlayResult(full_name='▼BP-SI', short_name='BP-SI'),
'bp-si': PlayResult(full_name='▼BP-SI', short_name='BP-SI'),
'walk': PlayResult(full_name='WALK', short_name='WALK'),
'fly-rf': PlayResult(full_name=f'fly (rf) B', short_name=f'fly (rf) B'),
'fly-lf': PlayResult(full_name=f'fly (lf) B', short_name=f'fly (lf) B'),
@ -2314,7 +2314,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_p
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'gb (p) X', short_name=f'gb (p) X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'GB (p) X', short_name=f'GB (p) X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]
@ -2324,7 +2324,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_c
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'catch X', short_name=f'catch X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'CATCH X', short_name=f'CATCH X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]
@ -2334,7 +2334,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_1b
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'gb (1b) X', short_name=f'gb (1b) X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'GB (1b) X', short_name=f'GB (1b) X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]
@ -2344,7 +2344,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_3b
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'gb (3b) X', short_name=f'gb (3b) X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'GB (3b) X', short_name=f'GB (3b) X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]
@ -2354,7 +2354,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_rf
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'fly (rf) X', short_name=f'fly (rf) X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'FLY (rf) X', short_name=f'FLY (rf) X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]
@ -2364,7 +2364,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_lf
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'fly (lf) X', short_name=f'fly (lf) X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'FLY (lf) X', short_name=f'FLY (lf) X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]
@ -2374,7 +2374,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_2b
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'gb (2b) X', short_name=f'gb (2b) X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'GB (2b) X', short_name=f'GB (2b) X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]
@ -2384,7 +2384,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_cf
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'fly (cf) X', short_name=f'fly (cf) X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'FLY (cf) X', short_name=f'FLY (cf) X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]
@ -2394,7 +2394,7 @@ def get_pitcher_card_data(player, pitching_card, ratings_vl, ratings_vr, positio
res_chances = data.xcheck_ss
while res_chances > 0:
ch = get_chances(res_chances)
r_val = assign_pchances(card, PlayResult(full_name=f'gb (ss) X', short_name=f'gb (ss) X'), ch)
r_val = assign_pchances(card, PlayResult(full_name=f'GB (ss) X', short_name=f'GB (ss) X'), ch)
logging.debug(f'Returned batting chances: {r_val[0]} / {r_val[1]}\n')
res_chances -= r_val[0]