mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
try: fix all fav tracks order
This commit is contained in:
@@ -137,7 +137,6 @@ def get_favorite_tracks(query: GetAllOfTypeQuery):
|
|||||||
Others will return -1
|
Others will return -1
|
||||||
"""
|
"""
|
||||||
tracks, total = FavoritesTable.get_fav_tracks(query.start, query.limit)
|
tracks, total = FavoritesTable.get_fav_tracks(query.start, query.limit)
|
||||||
tracks.reverse()
|
|
||||||
tracks = TrackStore.get_tracks_by_trackhashes([t.hash for t in tracks])
|
tracks = TrackStore.get_tracks_by_trackhashes([t.hash for t in tracks])
|
||||||
|
|
||||||
return {"tracks": serialize_tracks(tracks), "total": total}
|
return {"tracks": serialize_tracks(tracks), "total": total}
|
||||||
|
|||||||
+3
-1
@@ -221,7 +221,9 @@ class FavoritesTable(Base):
|
|||||||
result = cls.execute(
|
result = cls.execute(
|
||||||
select(cls)
|
select(cls)
|
||||||
# .select_from(join(table, cls, field == cls.hash))
|
# .select_from(join(table, cls, field == cls.hash))
|
||||||
.where(and_(cls.type == type, cls.userid == get_current_userid())).offset(
|
.where(and_(cls.type == type, cls.userid == get_current_userid()))
|
||||||
|
.order_by(cls.timestamp.desc())
|
||||||
|
.offset(
|
||||||
start
|
start
|
||||||
)
|
)
|
||||||
# INFO: If start is 0, fetch all so we can get the total count
|
# INFO: If start is 0, fetch all so we can get the total count
|
||||||
|
|||||||
Reference in New Issue
Block a user