Fix user and library recently played sorting order

This commit is contained in:
JonnyWong16
2020-08-23 18:17:41 -07:00
parent 9b3bfd14db
commit 67b452a461
2 changed files with 2 additions and 2 deletions

View File

@@ -836,7 +836,7 @@ class Libraries(object):
'JOIN session_history ON session_history_metadata.id = session_history.id ' \
'WHERE section_id = ? ' \
'GROUP BY session_history.rating_key ' \
'ORDER BY started DESC LIMIT ?'
'ORDER BY MAX(started) DESC LIMIT ?'
result = monitor_db.select(query, args=[section_id, limit])
else:
result = []

View File

@@ -602,7 +602,7 @@ class Users(object):
'WHERE user_id = ? ' \
'GROUP BY (CASE WHEN session_history.media_type = "track" THEN session_history.parent_rating_key ' \
' ELSE session_history.rating_key END) ' \
'ORDER BY started DESC LIMIT ?'
'ORDER BY MAX(started) DESC LIMIT ?'
result = monitor_db.select(query, args=[user_id, limit])
else:
result = []