albums sort by date instead of alphabetically

This commit is contained in:
iou1name 2019-05-15 13:08:28 -04:00
parent ec89df7a88
commit 38808dba67

View File

@ -187,8 +187,9 @@ class Selection(Resource):
found.append(track) found.append(track)
if not found: if not found:
abort(404, message="Artist does not exist.") abort(404, message="Artist does not exist.")
found = list(set(t.album for t in found)) seen = {track.album: track.date for track in found}
return sorted(found) found = sorted(seen.keys(), key=lambda album: seen[album])
return found
class RandomSelection(Resource): class RandomSelection(Resource):