mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-25 04:12:44 +03:00
fix(notifications): dead notifications that are still present long after (#1186)
This commit is contained in:
parent
86c10bd14d
commit
f847ee84a9
@ -1,3 +1,4 @@
|
|||||||
|
from datetime import datetime, timedelta
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
@ -115,10 +116,13 @@ class Notifications(Repository):
|
|||||||
Returns:
|
Returns:
|
||||||
list[Notification]: The notifications
|
list[Notification]: The notifications
|
||||||
"""
|
"""
|
||||||
|
five_minutes_ago = datetime.now() - timedelta(minutes=5)
|
||||||
|
|
||||||
notifications = (
|
notifications = (
|
||||||
self.db.from_("notifications")
|
self.db.from_("notifications")
|
||||||
.select("*")
|
.select("*")
|
||||||
.filter("chat_id", "eq", chat_id)
|
.filter("chat_id", "eq", chat_id)
|
||||||
|
.filter("datetime", "lt", five_minutes_ago)
|
||||||
.execute()
|
.execute()
|
||||||
).data
|
).data
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user