feat(赛马): 为马匹添加序号并优化积分结算展示
- 为 Horse 模型添加 index 字段,用于唯一标识马匹序号 - 在报名时自动分配递增序号,并在所有展示中使用固定序号排序 - 新增积分变化计算功能,在比赛结果中展示每位用户的积分变化和总结描述 - 支持通过序号或马匹名下注,优化用户交互体验 - 添加用户上次马名记忆功能,允许重复使用马名报名 - 更新测试用例以验证序号展示和积分变化功能
This commit is contained in:
@@ -21,6 +21,7 @@ class HorseState(str, Enum):
|
||||
class Horse:
|
||||
owner_id: str
|
||||
name: str
|
||||
index: int = 0
|
||||
position: float = 0.0
|
||||
state: HorseState = HorseState.READY
|
||||
|
||||
@@ -41,6 +42,7 @@ class Room:
|
||||
bets: list[Bet] = field(default_factory=list)
|
||||
champion_name: Optional[str] = None
|
||||
tick_count: int = 0
|
||||
next_horse_index: int = 1
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -53,3 +55,5 @@ class RaceResult:
|
||||
bet_distribution: dict[str, int]
|
||||
duration_ticks: int
|
||||
completed_at: datetime
|
||||
point_changes: dict[str, int] = field(default_factory=dict)
|
||||
point_change_summaries: dict[str, str] = field(default_factory=dict)
|
||||
|
||||
Reference in New Issue
Block a user