Module: deluge
Branch: master
Commit: 76de427b96e2053e98972178c97fefcfb2e2dc7f

Author: Damien Churchill <[email protected]>
Date:   Tue Mar 30 00:21:37 2010 +0100

remove a needless loop in the update_ui() method call

---

 deluge/ui/web/js/deluge-all/Torrents.js       |    4 ++--
 deluge/ui/web/js/deluge-all/data/SortTypes.js |    4 ++++
 deluge/ui/web/json_api.py                     |    5 -----
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/deluge/ui/web/js/deluge-all/Torrents.js 
b/deluge/ui/web/js/deluge-all/Torrents.js
index 614f2a4..af4a64d 100644
--- a/deluge/ui/web/js/deluge-all/Torrents.js
+++ b/deluge/ui/web/js/deluge-all/Torrents.js
@@ -34,7 +34,7 @@
 
        /* Renderers for the Torrent Grid */
        function queueRenderer(value) {
-               return (value == 99999) ? '' : value + 1;
+               return (value == -1) ? '' : value + 1;
        }
        function torrentNameRenderer(value, p, r) {
                return String.format('<div class="torrent-name 
x-deluge-{0}">{1}</div>', r.data['state'].toLowerCase(), value);
@@ -98,7 +98,7 @@
                                        root: 'torrents',
                                        idProperty: 'id',
                                        fields: [
-                                               {name: 'queue'},
+                                               {name: 'queue', sortType: 
Deluge.data.SortTypes.asQueuePosition},
                                                {name: 'name'},
                                                {name: 'total_size', type: 
'int'},
                                                {name: 'state'},
diff --git a/deluge/ui/web/js/deluge-all/data/SortTypes.js 
b/deluge/ui/web/js/deluge-all/data/SortTypes.js
index 6f04bb2..a31306d 100644
--- a/deluge/ui/web/js/deluge-all/data/SortTypes.js
+++ b/deluge/ui/web/js/deluge-all/data/SortTypes.js
@@ -44,5 +44,9 @@ Deluge.data.SortTypes = {
        asIPAddress: function(value) {
                var d = 
value.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/);
                return ((((((+d[1])*256)+(+d[2]))*256)+(+d[3]))*256)+(+d[4]);
+       },
+
+       asQueuePosition: function(value) {
+               return (value > -1) ? value : 9999999;
        }
 }
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py
index 910a568..ad36b82 100644
--- a/deluge/ui/web/json_api.py
+++ b/deluge/ui/web/json_api.py
@@ -516,11 +516,6 @@ class WebApi(JSONComponent):
 
         def got_torrents(torrents):
             ui_info["torrents"] = torrents
-            for id in torrents:
-                torrent = torrents[id]
-                torrent["id"] = id
-                if torrent["queue"] == -1:
-                    torrent["queue"] = 99999
 
         def on_complete(result):
             d.callback(ui_info)

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to