Closed Elliander closed 5 years ago
Thanks, I updated to
=0+COUNTIF(A5:A, "Copied")
Folders are technically files in Google Drive. Without logging the mimetype of the file copied, I wouldn't be able to filter on that in the spreadsheet, so I'm going to leave as-is for now.
Are you requesting a feature or reporting a bug?
Bug
If reporting a bug, is there already an issue open for this same bug?
Sort of. It's mentioned in other threads, such as the comments in https://github.com/ericyd/gdrive-copy/issues/86 , but I identified a solution.
What is the current behavior?
On cell 2F we are told the "Total Lines Copied", but this number is not correct. It counts the first line, "Started copying" as a copied item. It also counts file copy errors as copied. This is due to this line of code in cell 2F in the spreadsheet:
=COUNTA(A5:A)-COUNTIF(A5:A,"*Paused due to Google quota limits*")-COUNTIF(A5:A, "*Expected end of stream*")-COUNTIF(A5:A, "*Error restarting script*")-COUNTIF(A5:A, "*Error setting trigger*")-COUNTIF(A5:A, "*is not defined*")
What is the expected behavior?
It should not count any line that didn't represent a copied item. This may or may not be the cause of looping errors I have otherwise experienced, which I am currently trying to work around, but it's something I identified as a problem just the same.
How would you reproduce the current behavior (if this is a bug)?
Reproducing the error is self explanatory here, but resolving it is simple. Just replace the code currently in cell 2F with:
=COUNTA(A5:A)-COUNTIF(A5:A, "*Started Copying*")-COUNTIF(A5:A,"*Error: API call to drive.files.copy failed with error:*")-COUNTIF(A5:A,"*Paused due to Google quota limits*")-COUNTIF(A5:A, "*Expected end of stream*")-COUNTIF(A5:A, "*Error restarting script*")-COUNTIF(A5:A, "*Error setting trigger*")-COUNTIF(A5:A, "*is not defined*")
And the "Total Files Copied" count shows the correct number.
However, since the code is written to count all lines and then subtract lines that do not say "Copied" you would also have to add lines for every other message that could possibly be generated, and I can only test against the lines I've seen so far.
For maintainability, consider instead using this for cell 2F instead:
=0+COUNTIF(A5:A, "Copied")
Which also results in the correct number.
This is a much more elegant solution. Currently, the program counts all cells and then subtracts everything other than "Copied" and therefore produces errors as your code grows more complex, but if you instead start with 0 and then only count the lines that say "Copied" you won't have to update this later unless you explicitly needed to count something else.
Either approach will solve the bug.
There is, however, one other problem neither solution solves: Folders count as copied files. That can't be corrected without changing the status. For example, if instead of "Copied" it said "File Copied" or "Folder Copied" you'd be able to display either or as correct totals. This is just something I just noticed, and so edited the issue with details of, but I consider it minor.
Specify your