From 830630520702ee57a94902e216c03d2ee5aaa9c3 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Thu, 25 Dec 2014 23:59:52 +0100 Subject: [PATCH] Fixed: UI now properly sorts on the Peers column. --- src/UI/Episode/Search/ManualLayout.js | 5 +++-- src/UI/Release/ReleaseCollection.js | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/UI/Episode/Search/ManualLayout.js b/src/UI/Episode/Search/ManualLayout.js index 31f8c6766..faa7218fa 100644 --- a/src/UI/Episode/Search/ManualLayout.js +++ b/src/UI/Episode/Search/ManualLayout.js @@ -26,7 +26,8 @@ define( name : 'protocol', label : 'Source', cell : ProtocolCell - }, { + }, + { name : 'age', label : 'Age', cell : AgeCell @@ -66,7 +67,7 @@ define( name : 'download', label : '', cell : DownloadReportCell, - sortable : false + sortable : true // Is the default sort, which sorts by the internal prioritization logic. } ], diff --git a/src/UI/Release/ReleaseCollection.js b/src/UI/Release/ReleaseCollection.js index 0093e0022..a55111d77 100644 --- a/src/UI/Release/ReleaseCollection.js +++ b/src/UI/Release/ReleaseCollection.js @@ -30,7 +30,14 @@ define( return releaseWeight; } }, - 'download' : { sortKey: 'releaseWeight' } + 'download' : { sortKey: 'releaseWeight' }, + 'seeders' : { sortValue: function(model) { + var seeders = model.get('seeders') || 0; + var leechers = model.get('leechers') || 0; + + return seeders * 1000000 + leechers; + } + } }, fetchEpisodeReleases: function (episodeId) {