Add gauntlet to player replacement check
This commit is contained in:
parent
e8a5c6f503
commit
67555d3b55
@ -457,6 +457,10 @@ async def get_batting_totals(
|
|||||||
bat_plays = bat_plays.order_by(SQL('sum_pa').desc())
|
bat_plays = bat_plays.order_by(SQL('sum_pa').desc())
|
||||||
elif sort == 'pa-asc':
|
elif sort == 'pa-asc':
|
||||||
bat_plays = bat_plays.order_by(SQL('sum_pa').asc())
|
bat_plays = bat_plays.order_by(SQL('sum_pa').asc())
|
||||||
|
elif sort == 're24-desc':
|
||||||
|
bat_plays = bat_plays.order_by(SQL('sum_re24').desc())
|
||||||
|
elif sort == 're24-asc':
|
||||||
|
bat_plays = bat_plays.order_by(SQL('sum_re24').asc())
|
||||||
elif sort == 'newest':
|
elif sort == 'newest':
|
||||||
bat_plays = bat_plays.order_by(StratPlay.game_id.desc(), StratPlay.play_num.desc())
|
bat_plays = bat_plays.order_by(StratPlay.game_id.desc(), StratPlay.play_num.desc())
|
||||||
run_plays = run_plays.order_by(StratPlay.game_id.desc(), StratPlay.play_num.desc())
|
run_plays = run_plays.order_by(StratPlay.game_id.desc(), StratPlay.play_num.desc())
|
||||||
@ -660,6 +664,7 @@ async def get_pitching_totals(
|
|||||||
if team_id is not None:
|
if team_id is not None:
|
||||||
all_teams = Team.select().where(Team.id << team_id)
|
all_teams = Team.select().where(Team.id << team_id)
|
||||||
pit_plays = pit_plays.where(StratPlay.pitcher_team << all_teams)
|
pit_plays = pit_plays.where(StratPlay.pitcher_team << all_teams)
|
||||||
|
all_dec = all_dec.where(Decision.pitcher_team << all_teams)
|
||||||
|
|
||||||
if obc is not None:
|
if obc is not None:
|
||||||
pit_plays = pit_plays.where(StratPlay.on_base_code << obc)
|
pit_plays = pit_plays.where(StratPlay.on_base_code << obc)
|
||||||
|
|||||||
@ -264,7 +264,7 @@ async def get_team_lineup(team_id: int, difficulty_name: str, pitcher_name: str,
|
|||||||
backup_group = CardPosition.select().where(
|
backup_group = CardPosition.select().where(
|
||||||
(CardPosition.position == position) & (CardPosition.player << backup_players)
|
(CardPosition.position == position) & (CardPosition.player << backup_players)
|
||||||
)
|
)
|
||||||
if difficulty_name == 'minor-league':
|
if difficulty_name in ['minor-league', 'gauntlet-3']:
|
||||||
pos_group = pos_group.order_by(CardPosition.innings.desc())
|
pos_group = pos_group.order_by(CardPosition.innings.desc())
|
||||||
elif d_rank == 10:
|
elif d_rank == 10:
|
||||||
pos_group = pos_group.order_by((CardPosition.range * 5) + CardPosition.error)
|
pos_group = pos_group.order_by((CardPosition.range * 5) + CardPosition.error)
|
||||||
@ -274,7 +274,7 @@ async def get_team_lineup(team_id: int, difficulty_name: str, pitcher_name: str,
|
|||||||
pos_group = pos_group.order_by(CardPosition.error.desc())
|
pos_group = pos_group.order_by(CardPosition.error.desc())
|
||||||
|
|
||||||
logging.info(f'pos_group: {pos_group}\n{starting_nine}\n{player_names}\n\n')
|
logging.info(f'pos_group: {pos_group}\n{starting_nine}\n{player_names}\n\n')
|
||||||
if difficulty_name == 'minor-league':
|
if difficulty_name in ['minor-league', 'gauntlet-3']:
|
||||||
for x in pos_group:
|
for x in pos_group:
|
||||||
logging.info(f'checking {x.player.p_name} for {position}')
|
logging.info(f'checking {x.player.p_name} for {position}')
|
||||||
if x.player.p_name not in player_names and x.player.p_name.lower() != pitcher_name:
|
if x.player.p_name not in player_names and x.player.p_name.lower() != pitcher_name:
|
||||||
@ -543,8 +543,11 @@ async def get_team_rp(
|
|||||||
db.close()
|
db.close()
|
||||||
return this_player
|
return this_player
|
||||||
|
|
||||||
|
logging.info(f'Falling to last chance pitcher')
|
||||||
all_relievers = sort_pitchers(
|
all_relievers = sort_pitchers(
|
||||||
PitchingCard.select().join(Player).where((PitchingCard.player << backup_players))
|
PitchingCard.select().join(Player).where(
|
||||||
|
(PitchingCard.player << backup_players) | (PitchingCard.player << legal_players)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if all_relievers is not None:
|
if all_relievers is not None:
|
||||||
@ -620,7 +623,8 @@ async def team_buy_players(team_id: int, ids: str, ts: str):
|
|||||||
created=int_timestamp(datetime.now()),
|
created=int_timestamp(datetime.now()),
|
||||||
title=f'Price Change',
|
title=f'Price Change',
|
||||||
desc='Modified by buying and selling',
|
desc='Modified by buying and selling',
|
||||||
field_name=f'{this_player.description}',
|
field_name=f'{this_player.description} '
|
||||||
|
f'{this_player.p_name if this_player.p_name not in this_player.description else ""}',
|
||||||
message=f'From {buy_price}₼ 📈 to **{this_player.cost}**₼',
|
message=f'From {buy_price}₼ 📈 to **{this_player.cost}**₼',
|
||||||
about=f'Player-{this_player.player_id}'
|
about=f'Player-{this_player.player_id}'
|
||||||
)
|
)
|
||||||
@ -747,7 +751,8 @@ async def team_sell_cards(team_id: int, ids: str, ts: str):
|
|||||||
created=int_timestamp(datetime.now()),
|
created=int_timestamp(datetime.now()),
|
||||||
title=f'Price Change',
|
title=f'Price Change',
|
||||||
desc='Modified by buying and selling',
|
desc='Modified by buying and selling',
|
||||||
field_name=f'{this_player.description}',
|
field_name=f'{this_player.description} '
|
||||||
|
f'{this_player.p_name if this_player.p_name not in this_player.description else ""}',
|
||||||
message=f'From {orig_price}₼ 📉 to **{this_player.cost}**₼',
|
message=f'From {orig_price}₼ 📉 to **{this_player.cost}**₼',
|
||||||
about=f'Player-{this_player.id}'
|
about=f'Player-{this_player.id}'
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user