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
No known key found for this signature in database
GPG key ID: 7A649674469E6574
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 = []