diff --git a/src/scripts/services/aria2TaskService.js b/src/scripts/services/aria2TaskService.js index 45bdd5e..21af9e0 100644 --- a/src/scripts/services/aria2TaskService.js +++ b/src/scripts/services/aria2TaskService.js @@ -77,14 +77,20 @@ task.hasTaskName = taskNameResult.success; if (task.files) { + var selectedFileCount = 0; + for (var i = 0; i < task.files.length; i++) { var file = task.files[i]; file.fileName = getFileName(file); file.length = parseInt(file.length); - file.selected = (file.selected == 'true'); + file.selected = (file.selected === true || file.selected === 'true'); file.completedLength = parseInt(file.completedLength); file.completePercent = (file.length > 0 ? file.completedLength / file.length * 100 : 0); + + selectedFileCount += file.selected ? 1 : 0; } + + task.selectedFileCount = selectedFileCount; } return task; diff --git a/src/views/list.html b/src/views/list.html index 5ebd214..398d280 100644 --- a/src/views/list.html +++ b/src/views/list.html @@ -45,7 +45,7 @@
diff --git a/src/views/task-detail.html b/src/views/task-detail.html index 0572da1..08d8066 100644 --- a/src/views/task-detail.html +++ b/src/views/task-detail.html @@ -37,7 +37,7 @@