Skip to content

Commit

Permalink
fix: Last updated call was not every time sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Jan 16, 2024
1 parent 83abb32 commit d910337
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ async def get_call_by_id(call_id: UUID) -> Optional[CallModel]:
async def get_last_call_by_phone_number(phone_number: str) -> Optional[CallModel]:
async with aiosqlite.connect(CONFIG.database.sqlite_path) as db:
cursor = await db.execute(
f"SELECT data FROM calls WHERE phone_number = ? AND DATETIME(created_at) > DATETIME('now', '-{CONFIG.workflow.conversation_timeout_hour} hours') ORDER BY created_at DESC LIMIT 1",
f"SELECT data FROM calls WHERE phone_number = ? AND DATETIME(created_at) > DATETIME('now', '-{CONFIG.workflow.conversation_timeout_hour} hours') ORDER BY DATETIME(created_at) DESC LIMIT 1",
(phone_number,),
)
row = await cursor.fetchone()
Expand Down

0 comments on commit d910337

Please sign in to comment.