Improved home page sorting for artists with an unknown number of total tracks by sorting by the number of Tracks we have after sorting by the percentage

This commit is contained in:
Patrick Speiser
2012-09-30 19:45:39 +02:00
parent acfc470681
commit 2f488b767c

View File

@@ -465,7 +465,7 @@ class WebInterface(object):
totalcount = myDB.select('SELECT COUNT(*) from artists')[0][0]
if sortbyhavepercent:
filtered.sort(key=lambda x:float(x['HaveTracks'])/x['TotalTracks'] if x['TotalTracks'] > 0 else 0.0,reverse=sSortDir_0 == "asc")
filtered.sort(key=lambda x:(float(x['HaveTracks'])/x['TotalTracks'] if x['TotalTracks'] > 0 else 0.0,x['HaveTracks'] if x['HaveTracks'] else 0.0),reverse=sSortDir_0 == "asc")
#can't figure out how to change the datatables default sorting order when its using an ajax datasource so ill
#just reverse it here and the first click on the "Latest Album" header will sort by descending release date