Rework data models: reorganized and extended models for UserProfile, Game, and others, added new models (RoundGuess, UserStats, Achievement, SeasonStats, DailyChallenge), and updated __init__.py.
This commit is contained in:
parent
cfe4a641a6
commit
6548f11884
11 changed files with 298 additions and 73 deletions
29
src/geoguessr_mcp/models/RoundGuess.py
Normal file
29
src/geoguessr_mcp/models/RoundGuess.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""RoundGuess-related data models."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class RoundGuess:
|
||||
"""Represents a single round guess in a game."""
|
||||
round_number: int
|
||||
score: int
|
||||
distance_meters: float
|
||||
time_seconds: int
|
||||
lat: Optional[float] = None
|
||||
lng: Optional[float] = None
|
||||
country: str = ""
|
||||
|
||||
@classmethod
|
||||
def from_api_response(cls, data: dict, round_num: int = 0) -> "RoundGuess":
|
||||
"""Create RoundGuess from API response."""
|
||||
return cls(
|
||||
round_number=round_num,
|
||||
score=data.get("roundScoreInPoints", data.get("score", 0)),
|
||||
distance_meters=data.get("distanceInMeters", data.get("distance", 0)),
|
||||
time_seconds=data.get("time", data.get("timeInSeconds", 0)),
|
||||
lat=data.get("lat", data.get("latitude")),
|
||||
lng=data.get("lng", data.get("longitude")),
|
||||
country=data.get("country", ""),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue