add timestamp to favorite entries

+ convert useBisection into a function
This commit is contained in:
mungai-njoroge
2024-03-10 17:21:22 +03:00
committed by Mungai Njoroge
parent fb635ff35f
commit 766eb388b2
9 changed files with 95 additions and 52 deletions
+4 -2
View File
@@ -1,3 +1,4 @@
from datetime import datetime
from app.models import FavType
from .utils import SQLiteManager
@@ -26,9 +27,10 @@ class SQLiteFavoriteMethods:
if cls.check_is_favorite(fav_hash, fav_type):
return
sql = """INSERT INTO favorites(type, hash) VALUES(?,?)"""
sql = """INSERT INTO favorites(type, hash, timestamp) VALUES(?,?,?)"""
current_timestamp = datetime.now().timestamp()
with SQLiteManager(userdata_db=True) as cur:
cur.execute(sql, (fav_type, fav_hash))
cur.execute(sql, (fav_type, fav_hash, current_timestamp))
cur.close()
@classmethod