show the number of selected files instead of the number of all files

This commit is contained in:
MaysWind 2016-06-28 00:32:17 +08:00
parent ba4d540d03
commit e8d052e4f0
3 changed files with 9 additions and 3 deletions

View file

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

View file

@ -45,7 +45,7 @@
<div class="task-files">
<span ng-bind="task.totalLength | readableVolumn"></span>
<a ng-href="#/task/detail/{{task.gid}}">
<span ng-if="task.files" ng-bind="('format.settings.file-count' | translate: {count: task.files.length})"></span>
<span ng-if="task.files" ng-bind="('format.settings.file-count' | translate: {count: task.selectedFileCount})"></span>
</a>
</div>
</div>

View file

@ -37,7 +37,7 @@
</div>
<div class="setting-value col-sm-8">
<span ng-bind="task.totalLength | readableVolumn"></span>
<span ng-if="task.files" ng-bind="('format.settings.file-count' | translate: {count: task.files.length})"></span>
<span ng-if="task.files" ng-bind="('format.settings.file-count' | translate: {count: task.selectedFileCount})"></span>
</div>
</div>
<div class="row" ng-if="task">