adjust task order

This commit is contained in:
MaysWind 2016-05-28 22:31:07 +08:00
parent 8173e5ec27
commit 741ffe245a
2 changed files with 4 additions and 3 deletions

View file

@ -86,6 +86,7 @@
task.uploadSpeed = parseInt(task.uploadSpeed);
task.downloadSpeed = parseInt(task.downloadSpeed);
task.completePercent = (task.totalLength > 0 ? task.completedLength / task.totalLength * 100 : 0);
task.remainPercent = 100 - task.completePercent;
task.taskName = this.getTaskName(task);
task.idle = task.downloadSpeed == 0;

View file

@ -6,9 +6,9 @@
if (!angular.isArray(array)) {
return array;
}
var orderType = utils.parseOrderType(type);
if (orderType == null) {
return array;
}
@ -20,7 +20,7 @@
} else if (orderType.type == 'percent') {
return orderByFilter(array, ['completePercent'], orderType.reverse);
} else if (orderType.type == 'remain') {
return orderByFilter(array, ['idle', 'remainTime'], orderType.reverse);
return orderByFilter(array, ['idle', 'remainTime', 'remainPercent'], orderType.reverse);
} else if (orderType.type == 'dspeed') {
return orderByFilter(array, ['downloadSpeed'], orderType.reverse);
} else {