modify task sort

This commit is contained in:
MaysWind 2016-05-31 22:55:25 +08:00
parent 26e25830e8
commit 55115f13ab
2 changed files with 8 additions and 6 deletions

View file

@ -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', 'remainPercent'], orderType.reverse);
return orderByFilter(array, ['idle', 'remainTime', 'remainLength'], orderType.reverse);
} else if (orderType.type == 'dspeed') {
return orderByFilter(array, ['downloadSpeed'], orderType.reverse);
} else {

View file

@ -53,15 +53,17 @@
task.totalLength = parseInt(task.totalLength);
task.completedLength = parseInt(task.completedLength);
task.completePercent = (task.totalLength > 0 ? task.completedLength / task.totalLength * 100 : 0);
task.remainLength = task.totalLength - task.completedLength;
task.remainPercent = 100 - task.completePercent;
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 = getTaskName(task);
task.idle = task.downloadSpeed == 0;
var remainLength = task.totalLength - task.completedLength;
task.remainTime = calculateDownloadRemainTime(remainLength, task.downloadSpeed);
task.remainTime = calculateDownloadRemainTime(task.remainLength, task.downloadSpeed);
if (task.files) {
for (var i = 0; i < task.files.length; i++) {
@ -171,7 +173,7 @@
if (!angular.isArray(tasks)) {
return;
}
for (var i = 0; i < tasks.length; i++) {
processDownloadTask(tasks[i]);
}