Beta day 1 bug fixes

This commit is contained in:
Cal Corum 2025-02-02 22:01:33 -06:00
parent cd9d5e49d0
commit 3b6bcfb186
5 changed files with 24 additions and 9 deletions

View File

@ -689,7 +689,7 @@ class Gameplay(commands.Cog):
view=view
)
# TODO: add new-game unlimited, and ranked
# TODO: add new-game ranked
@group_new_game.command(name='unlimited', description='Start a new Unlimited game against another human')
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
async def new_game_unlimited_command(self, interaction: discord.Interaction, away_team_abbrev: str, home_team_abbrev: str):

View File

@ -28,7 +28,7 @@ from in_game.gameplay_queries import get_team_or_none
from in_game.simulations import get_pos_embeds, get_result
from in_game.gameplay_models import Lineup, Play, Session, engine
from api_calls import db_get, db_post, db_patch, get_team_by_abbrev
from helpers import PD_PLAYERS_ROLE_NAME, IMAGES, PD_SEASON, random_conf_gif, fuzzy_player_search, ALL_MLB_TEAMS, \
from helpers import ACTIVE_EVENT_LITERAL, PD_PLAYERS_ROLE_NAME, IMAGES, PD_SEASON, random_conf_gif, fuzzy_player_search, ALL_MLB_TEAMS, \
fuzzy_search, get_channel, display_cards, get_card_embeds, get_team_embed, cardset_search, get_blank_team_card, \
get_team_by_owner, get_rosters, get_roster_sheet, legal_channel, random_conf_word, embed_pagination, get_cal_user, \
team_summary_embed, SelectView, SelectPaperdexCardset, SelectPaperdexTeam
@ -902,7 +902,7 @@ class Players(commands.Cog):
)
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
async def gauntlet_run_command(
self, interaction: discord.Interaction, event_name: Literal['2024 Season', 'Super Ultra Championship'],
self, interaction: discord.Interaction, event_name: ACTIVE_EVENT_LITERAL,
team_abbrev: str = None):
await interaction.response.defer()
@ -1032,7 +1032,7 @@ class Players(commands.Cog):
@group_gauntlet.command(name='reset', description='Wipe your current team so you can re-draft')
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
async def gauntlet_reset_command(
self, interaction: discord.Interaction, event_name: Literal['2024 Season', 'Super Ultra Championship']):
self, interaction: discord.Interaction, event_name: ACTIVE_EVENT_LITERAL):
await interaction.response.defer()
main_team = await get_team_by_owner(interaction.user.id)
draft_team = await get_team_by_abbrev(f'Gauntlet-{main_team["abbrev"]}')

View File

@ -572,7 +572,12 @@ def complete_play(session:Session, this_play: Play):
)).one()
if outs is None:
outs = 0
pow_outs = new_pitcher.card.pitcherscouting.pitchingcard.starter_rating * 3
if new_pitcher.replacing_id is None:
pow_outs = new_pitcher.card.pitcherscouting.pitchingcard.starter_rating * 3
else:
pow_outs = new_pitcher.card.pitcherscouting.pitchingcard.relief_rating * 3
if not new_pitcher.is_fatigued:
if outs >= pow_outs:
logger.info(f'Pitcher is beyond POW - adding fatigue')
@ -2946,6 +2951,8 @@ async def get_game_summary_embed(session: Session, interaction: discord.Interact
game_summary = await db_get(f'plays/game-summary/{db_game_id}', params=[('tp_max', num_potg)])
this_game = this_play.game
final_inning = this_play.inning_num if this_play.inning_half == 'bot' else this_play.inning_num - 1
game_embed = winning_team.embed
game_embed.title = f'{this_game.away_team.lname} {this_play.away_score} @ {this_play.home_score} {this_game.home_team.lname} - F/{this_play.inning_num}'
game_embed.add_field(

View File

@ -299,7 +299,7 @@ SELECT_CARDSET_OPTIONS = [
discord.SelectOption(label='2013 Season', value='6'),
discord.SelectOption(label='2012 Season', value='7')
]
ACTIVE_EVENT_LITERAL = Literal['1998 Season']
ACTIVE_EVENT_LITERAL = Literal['1998 Season', 'Brilliant Stars']
DEFENSE_LITERAL = Literal['Pitcher', 'Catcher', 'First Base', 'Second Base', 'Third Base', 'Shortstop', 'Left Field', 'Center Field', 'Right Field']
ACTIVE_EVENT_LITERAL = Literal['1998 Season', 'Brilliant Stars']
COLORS = {

View File

@ -292,7 +292,7 @@ async def get_pitcher_scouting_or_none(session: Session, card: Card, skip_cache:
tdelta = datetime.datetime.now() - this_scouting.created
logger.debug(f'tdelta: {tdelta}')
if tdelta.total_seconds() < CACHE_LIMIT and None not in [this_scouting.battingcard, this_scouting.ratings_vl, this_scouting.ratings_vr]:
if tdelta.total_seconds() < CACHE_LIMIT and None not in [this_scouting.pitchingcard, this_scouting.ratings_vl, this_scouting.ratings_vr]:
logger.info(f'returning cached scouting')
return this_scouting
@ -508,8 +508,16 @@ async def get_card_or_none(session: Session, card_id: int, skip_cache: bool = Fa
return this_card
else:
logger.info(f'deleting this_card')
session.delete(this_card.batterscouting)
session.delete(this_card.pitcherscouting)
try:
session.delete(this_card.batterscouting)
except Exception as e:
logger.error(f'Could not delete batter scouting: {e}')
try:
session.delete(this_card.pitcherscouting)
except Exception as e:
logger.error(f'Could not delete batter scouting: {e}')
session.delete(this_card)
session.commit()