- Fix TypeError in check_steal_opportunity by properly mocking catcher defense - Correct tag_from_third test calculation to account for all adjustment conditions - Fix pitcher replacement test by setting appropriate allowed runners threshold - Add comprehensive test coverage for AI service business logic - Implement VS Code testing panel configuration with pytest integration - Create pytest.ini for consistent test execution and warning management - Add test isolation guidelines and factory pattern implementation - Establish 102 passing tests with zero failures 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
"""PositionRating model - pure data container for player defensive ratings.
|
|
|
|
This model contains only data fields and relationships. No business logic
|
|
has been extracted as this was already a pure data model.
|
|
"""
|
|
|
|
import datetime
|
|
from sqlmodel import SQLModel, Field, Relationship, UniqueConstraint
|
|
from sqlalchemy import Column, BigInteger
|
|
|
|
|
|
class PositionRatingBase(SQLModel):
|
|
"""Base position rating data fields."""
|
|
__table_args__ = (UniqueConstraint("player_id", "variant", "position"),)
|
|
|
|
id: int | None = Field(default=None, sa_column=Column(BigInteger(), primary_key=True, autoincrement=True))
|
|
player_id: int = Field(index=True) # TODO: Add foreign_key='player.id' when Player model is migrated
|
|
variant: int = Field(default=0, index=True)
|
|
position: str = Field(index=True)
|
|
innings: int = Field(default=0)
|
|
range: int = Field(default=5)
|
|
error: int = Field(default=0)
|
|
arm: int | None = Field(default=None)
|
|
pb: int | None = Field(default=None)
|
|
overthrow: int | None = Field(default=None)
|
|
created: datetime.datetime = Field(default_factory=datetime.datetime.now, nullable=True)
|
|
|
|
|
|
class PositionRating(PositionRatingBase, table=True):
|
|
"""PositionRating model with relationships."""
|
|
# Note: Relationship to Player commented out until Player model is migrated
|
|
# player: 'Player' = Relationship(back_populates='positions')
|
|
pass |