fix: show stats by logged in user

This commit is contained in:
cwilvx
2024-10-21 10:01:41 +03:00
parent a7666ad935
commit aea8c15f6f
4 changed files with 6 additions and 39 deletions
+4 -3
View File
@@ -257,9 +257,9 @@ class FavoritesTable(Base):
@classmethod
def count_favs_in_period(cls, start_time: int, end_time: int):
result = cls.execute(
select(func.count(cls.id)).where(
and_(cls.timestamp >= start_time, cls.timestamp <= end_time)
)
select(func.count(cls.id))
.where((cls.userid == get_current_userid()))
.where(and_(cls.timestamp >= start_time, cls.timestamp <= end_time))
)
result = result.fetchone()
@@ -306,6 +306,7 @@ class ScrobbleTable(Base):
def get_all_in_period(cls, start_time: int, end_time: int):
result = cls.execute(
select(cls)
.where(cls.userid == get_current_userid())
.where(and_(cls.timestamp >= start_time, cls.timestamp <= end_time))
.order_by(cls.timestamp.desc())
)