Fix standings bug & s9 update
This commit is contained in:
parent
11568a2d2e
commit
e4d2e432dd
@ -679,7 +679,8 @@ async def get_team_rp(
|
||||
@router.get('/{team_id}/season-record/{season}')
|
||||
async def get_team_record(team_id: int, season: int):
|
||||
all_games = StratGame.select().where(
|
||||
((StratGame.away_team_id == team_id) | (StratGame.home_team_id == team_id)) & (StratGame.season == season)
|
||||
((StratGame.away_team_id == team_id) | (StratGame.home_team_id == team_id)) & (StratGame.season == season) &
|
||||
(StratGame.short_game == False)
|
||||
)
|
||||
|
||||
template = {
|
||||
@ -695,7 +696,9 @@ async def get_team_record(team_id: int, season: int):
|
||||
'minor-league': copy.deepcopy(template),
|
||||
'major-league': copy.deepcopy(template),
|
||||
'hall-of-fame': copy.deepcopy(template),
|
||||
'flashback': copy.deepcopy(template)
|
||||
'flashback': copy.deepcopy(template),
|
||||
'unlimited': copy.deepcopy(template),
|
||||
'ranked': copy.deepcopy(template)
|
||||
}
|
||||
|
||||
for game in all_games:
|
||||
@ -709,9 +712,13 @@ async def get_team_record(team_id: int, season: int):
|
||||
standings[game.game_type][game.away_team.abbrev][2] -= run_diff
|
||||
elif run_diff < 0: # Home team won
|
||||
if game.away_team_id == team_id: # Human is away team
|
||||
if game.home_team.abbrev not in standings[game.game_type]:
|
||||
standings[game.game_type][game.home_team.abbrev] = [0, 0, 0]
|
||||
standings[game.game_type][game.home_team.abbrev][1] += 1
|
||||
standings[game.game_type][game.home_team.abbrev][2] -= run_diff
|
||||
else: # Human is home team
|
||||
if game.away_team.abbrev not in standings[game.game_type]:
|
||||
standings[game.game_type][game.away_team.abbrev] = [0, 0, 0]
|
||||
standings[game.game_type][game.away_team.abbrev][0] += 1
|
||||
standings[game.game_type][game.away_team.abbrev][2] -= run_diff
|
||||
|
||||
@ -1040,13 +1047,13 @@ async def team_season_update(new_season: int, token: str = Depends(oauth2_scheme
|
||||
detail='You are not authorized to post teams. This event has been logged.'
|
||||
)
|
||||
|
||||
r_query = Team.update(ranking=1000, season=new_season, wallet=Team.wallet + 250).execute()
|
||||
r_query = Team.update(ranking=1000, season=new_season, wallet=Team.wallet + 250, has_guide=False).execute()
|
||||
current = Current.latest()
|
||||
current.season = new_season
|
||||
current.save()
|
||||
db.close()
|
||||
|
||||
return {'detail': f'Team rankings, season, and wallet updated for season {new_season}'}
|
||||
return {'detail': f'Team rankings, season, guides, and wallets updated for season {new_season}'}
|
||||
|
||||
|
||||
@router.post('/{team_id}/money/{delta}')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user