diff --git a/PROJECT_PLAN.json b/PROJECT_PLAN.json index ee0577a..028c652 100644 --- a/PROJECT_PLAN.json +++ b/PROJECT_PLAN.json @@ -8,7 +8,7 @@ "branch": "postgres-migration", "totalEstimatedHours": 26, "totalTasks": 28, - "completedTasks": 24 + "completedTasks": 26 }, "context": { "sourceDatabase": { @@ -568,7 +568,7 @@ "id": "TS-012", "name": "Fix batstats.py GET created filter", "category": "medium", - "completed": false, + "completed": true, "file": "app/routers_v2/batstats.py", "lines": [74, 98], "notes": "Not actively used - commented out in gameplay_legacy.py" @@ -577,7 +577,7 @@ "id": "TS-013", "name": "Fix pitstats.py GET created filter", "category": "medium", - "completed": false, + "completed": true, "file": "app/routers_v2/pitstats.py", "lines": [60, 85], "notes": "Not actively used - commented out in gameplay_legacy.py" diff --git a/app/routers_v2/batstats.py b/app/routers_v2/batstats.py index 620fb43..21ace66 100644 --- a/app/routers_v2/batstats.py +++ b/app/routers_v2/batstats.py @@ -95,7 +95,9 @@ async def get_batstats( if week_end is not None: all_stats = all_stats.where(BattingStat.week <= week_end) if created is not None: - all_stats = all_stats.where(BattingStat.created == created) + # Convert milliseconds timestamp to datetime for PostgreSQL comparison + created_dt = datetime.fromtimestamp(created / 1000) + all_stats = all_stats.where(BattingStat.created == created_dt) # if all_stats.count() == 0: # db.close() diff --git a/app/routers_v2/pitstats.py b/app/routers_v2/pitstats.py index 29c4d3e..2713417 100644 --- a/app/routers_v2/pitstats.py +++ b/app/routers_v2/pitstats.py @@ -82,7 +82,9 @@ async def get_pit_stats( if week_end is not None: all_stats = all_stats.where(PitchingStat.week <= week_end) if created is not None: - all_stats = all_stats.where(PitchingStat.created <= created) + # Convert milliseconds timestamp to datetime for PostgreSQL comparison + created_dt = datetime.fromtimestamp(created / 1000) + all_stats = all_stats.where(PitchingStat.created <= created_dt) if gs is not None: all_stats = all_stats.where(PitchingStat.gs == 1 if gs else 0)