feat: add ProcessedGame ledger for full idempotency in update_season_stats() (#105) #106

Merged
cal merged 3 commits from ai/paper-dynasty-database#105 into card-evolution 2026-03-18 20:30:37 +00:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit db6f8d9b66 - Show all commits

View File

@ -7,6 +7,4 @@ RUN pip install --no-cache-dir -r requirements.txt
RUN playwright install chromium
RUN playwright install-deps chromium
COPY ./app /usr/src/app/app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
COPY ./app /app/app
Outdated
Review

The COPY destination is /app/app but should be /usr/src/app/app (matching WORKDIR /usr/src/app). Additionally, the CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] line is still missing. Both were present on next-release and must be restored. Without the correct path and CMD, the container will fail to start.

The `COPY` destination is `/app/app` but should be `/usr/src/app/app` (matching `WORKDIR /usr/src/app`). Additionally, the `CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]` line is still missing. Both were present on `next-release` and must be restored. Without the correct path and CMD, the container will fail to start.

View File

@ -159,6 +159,10 @@ def _build_pitching_groups(plays):
for play in plays:
pitcher_id = play.pitcher_id
pitcher_team_id = play.pitcher_team_id
if pitcher_id is None:
continue
Outdated
Review

Missing None guard for pitcher_id. The batting path has if batter_id is None: continue but the pitching path does not. A play row with pitcher_id=None would create a (None, pitcher_team_id) key in groups, which will then be passed to the upsert function as player_id=None and fail when Peewee tries to set a NOT NULL FK column. Add the same guard:

if pitcher_id is None:
    continue
Missing `None` guard for `pitcher_id`. The batting path has `if batter_id is None: continue` but the pitching path does not. A play row with `pitcher_id=None` would create a `(None, pitcher_team_id)` key in `groups`, which will then be passed to the upsert function as `player_id=None` and fail when Peewee tries to set a NOT NULL FK column. Add the same guard: ```python if pitcher_id is None: continue ```
key = (pitcher_id, pitcher_team_id)
g = groups[key]