idac: fix new round bugs

This commit is contained in:
Dniel97
2026-07-08 20:02:01 +02:00
parent 444e0ea04e
commit 08653f4095
2 changed files with 9 additions and 7 deletions
+2 -1
View File
@@ -1,10 +1,11 @@
from datetime import datetime
from typing import Optional
from titles.idac.model.common_model import DtoModel
class RoundInfoDto(DtoModel):
id: int
id: Optional[int] = None
round_id_in_json: int
name: str
start_dt: datetime
+7 -6
View File
@@ -151,16 +151,17 @@ class IDACSeason3TeamService:
new_league_rank_id = promote_effect_param.next_league_rank_id
if promote_effect_param.demote_rank > 0:
# Condition 1: Demotion (falls through to the default demote_league_rank_id)
if past_league_info.rank >= promote_effect_param.demote_rank:
if promote_effect_param.demote_rank is not None and promote_effect_param.demote_rank > 0:
# demotion, if rank is higher than demote rank or rank is 0 (no points)
if past_league_info.rank == 0 or past_league_info.rank >= promote_effect_param.demote_rank:
new_league_rank_id = promote_effect_param.demote_league_rank_id
# Condition 2: Maintain Rank (e.g., didn't hit demotion, but rank is > promotion threshold)
elif past_league_info.rank > promote_effect_param.rank:
# maintain rank
elif promote_effect_param.rank is not None and past_league_info.rank > promote_effect_param.rank:
new_league_rank_id = past_league_info.league_rank_id
# Condition 3: Promotion (falls through to the default next_league_rank_id)
# promotion, uses default next_league_rank_id
await self.data.team.put_league_info(
LeagueInfoDto(