fix: use Field(default_factory) for offense_col random default (#24)
All checks were successful
Build Docker Image / build (pull_request) Successful in 3m10s
All checks were successful
Build Docker Image / build (pull_request) Successful in 3m10s
Pydantic evaluates bare `random.randint(1, 3)` once at class definition time, so every PlayerModel instance shared the same value. Replaced with `pydantic.Field(default_factory=...)` so a new random value is generated per instance. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
41c50dac4f
commit
d26bc0dc7b
@ -37,7 +37,7 @@ class PlayerModel(pydantic.BaseModel):
|
||||
key_fangraphs: int = None
|
||||
key_bbref: str = None
|
||||
key_retro: str = None
|
||||
offense_col: int = random.randint(1, 3)
|
||||
offense_col: int = pydantic.Field(default_factory=lambda: random.randint(1, 3))
|
||||
|
||||
|
||||
class PlayerList(pydantic.BaseModel):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user