Fix PostgreSQL timestamp conversion for stats GET filters
Convert milliseconds to datetime for created filter in batstats.py and pitstats.py GET endpoints. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f3b0b90860
commit
f4aafa35e7
@ -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"
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user