remove a needless loop in the update_ui() method call

This commit is contained in:
Damien Churchill 2010-03-30 00:21:37 +01:00
parent e9df745dd0
commit 76de427b96
3 changed files with 6 additions and 7 deletions

View File

@ -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'},

View File

@ -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;
}
}

View File

@ -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)