From a1e611553afc5d8ccb862b7fc5ba384e26ec6ea3 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 7 Dec 2016 01:50:52 -0600 Subject: [PATCH] Fixes inaccurate count when no items are deleted --- shreddit/shredder.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shreddit/shredder.py b/shreddit/shredder.py index 8a9f208..e54d432 100644 --- a/shreddit/shredder.py +++ b/shreddit/shredder.py @@ -137,8 +137,10 @@ class Shredder(object): self._logger.info("Loading items to delete...") to_delete = [item for item in items] self._logger.info("Done. Starting on batch of {} items...".format(len(to_delete))) - for idx, item in enumerate(to_delete): - self._logger.debug("Examining item {}: {}".format(idx + 1, item)) + count = 0 + for item in to_delete: + count += 1 + self._logger.debug("Examining item {}: {}".format(count, item)) created = arrow.get(item.created_utc) if str(item.subreddit).lower() in self._blacklist: self._logger.debug("Deleting due to blacklist") @@ -154,7 +156,7 @@ class Shredder(object): continue else: self._remove(item) - return idx + 1 + return count def _build_iterator(self): item = self._r.user.me()