Fix upload progress.
Items are taken from the files
map before the upload starts therefore files.count()
will always equal to the remaining files to process minus the current processing item.
Examples:
-
We are processing the first and only upload, therefore:
originalFilesCount = 1 files.count() = 0 (the only file was already take()n) processedParts = 0 (we haven't finished the first and only upload yet) currentFileParts = x (some percentage) final values are (0 + x, 100)
-
We are processing the first of two uploads, therefore:
originalFilesCount = 2 files.count() = 1 (the first file was already take()n) processedParts = 0 (we haven't finished the first upload yet) currentFileParts = x (some percentage) final values are (0 + x, 200)
-
We are processing the second and last of two uploads, therefore:
originalFilesCount = 2 files.count() = 0 (the last file was already take()n) processedParts = 100 (we have finished the first upload already) currentFileParts = x (some percentage) final values are (100 + x, 200)