]> granicus.if.org Git - transmission/commitdiff
(trunk web) when sorting by ratio, use tr_stat.ratio rather than deriving it ourselves.
authorJordan Lee <jordan@transmissionbt.com>
Wed, 24 Aug 2011 19:20:22 +0000 (19:20 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Wed, 24 Aug 2011 19:20:22 +0000 (19:20 +0000)
web/javascript/torrent.js

index 23a774e7eed48013ed4428ac28de3abec1b690e6..5d1e8938c813f8040c18c3ae39f16dbf8fc0c2e2 100644 (file)
@@ -390,9 +390,11 @@ Torrent.compareByActivity = function(ta, tb)
 };
 Torrent.compareByRatio = function(ta, tb)
 {
-       var a = Math.ratio(ta.getUploadedEver(), ta.getDownloadedEver());
-       var b = Math.ratio(tb.getUploadedEver(), tb.getDownloadedEver());
-       return (a - b) || Torrent.compareByState(ta, tb);
+       var a = ta.getUploadRatio();
+       var b = tb.getUploadRatio();
+       if (a < b) return 1;
+       if (a > b) return -1;
+       return Torrent.compareByState(ta, tb);
 };
 Torrent.compareByProgress = function(ta, tb)
 {