Fix fatigue bugs

This commit is contained in:
Cal Corum 2025-02-11 00:58:45 -06:00
parent 4d59247e5c
commit 557404301a
2 changed files with 3 additions and 1 deletions

View File

@ -657,7 +657,7 @@ def complete_play(session:Session, this_play: Play):
if not new_pitcher.is_fatigued:
logger.info(f'checking for runners in POW')
runners_in_pow = session.exec(select(func.count(Play.id)).where(
Play.game == this_play.game, Play.pitcher == new_pitcher, Play.in_pow == True, Play.batter_final != None
Play.game == this_play.game, Play.pitcher == new_pitcher, Play.in_pow == True, or_(Play.hit == 1, Play.bb == 1), Play.ibb == 0
)).one() # change to hits and walks
logger.info(f'runners in pow: {runners_in_pow}')
if runners_in_pow >= 3:

View File

@ -212,6 +212,8 @@ class SelectReliefPitcher(discord.ui.Select):
return
await get_position(self.session, human_rp_card, 'P')
if human_rp_card.pitcherscouting.pitchingcard.relief_rating < 2:
this_play.in_pow = True
logger.info(f'Adding the RP lineup')
human_rp_lineup = Lineup(