modify task sort
This commit is contained in:
parent
26e25830e8
commit
55115f13ab
|
@ -20,7 +20,7 @@
|
||||||
} else if (orderType.type == 'percent') {
|
} else if (orderType.type == 'percent') {
|
||||||
return orderByFilter(array, ['completePercent'], orderType.reverse);
|
return orderByFilter(array, ['completePercent'], orderType.reverse);
|
||||||
} else if (orderType.type == 'remain') {
|
} 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') {
|
} else if (orderType.type == 'dspeed') {
|
||||||
return orderByFilter(array, ['downloadSpeed'], orderType.reverse);
|
return orderByFilter(array, ['downloadSpeed'], orderType.reverse);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,15 +53,17 @@
|
||||||
|
|
||||||
task.totalLength = parseInt(task.totalLength);
|
task.totalLength = parseInt(task.totalLength);
|
||||||
task.completedLength = parseInt(task.completedLength);
|
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.uploadSpeed = parseInt(task.uploadSpeed);
|
||||||
task.downloadSpeed = parseInt(task.downloadSpeed);
|
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.taskName = getTaskName(task);
|
||||||
task.idle = task.downloadSpeed == 0;
|
task.idle = task.downloadSpeed == 0;
|
||||||
|
|
||||||
var remainLength = task.totalLength - task.completedLength;
|
task.remainTime = calculateDownloadRemainTime(task.remainLength, task.downloadSpeed);
|
||||||
task.remainTime = calculateDownloadRemainTime(remainLength, task.downloadSpeed);
|
|
||||||
|
|
||||||
if (task.files) {
|
if (task.files) {
|
||||||
for (var i = 0; i < task.files.length; i++) {
|
for (var i = 0; i < task.files.length; i++) {
|
||||||
|
@ -171,7 +173,7 @@
|
||||||
if (!angular.isArray(tasks)) {
|
if (!angular.isArray(tasks)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < tasks.length; i++) {
|
for (var i = 0; i < tasks.length; i++) {
|
||||||
processDownloadTask(tasks[i]);
|
processDownloadTask(tasks[i]);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue