Skip to content

Instantly share code, notes, and snippets.

@hodgestar
Created December 17, 2014 08:09
Show Gist options
  • Save hodgestar/78e06cfd8775c6a5d293 to your computer and use it in GitHub Desktop.
Save hodgestar/78e06cfd8775c6a5d293 to your computer and use it in GitHub Desktop.
diff --git a/go/billing/tasks.py b/go/billing/tasks.py
index ec2b0e8..dc7ad13 100644
--- a/go/billing/tasks.py
+++ b/go/billing/tasks.py
@@ -271,7 +271,7 @@ def archive_transactions(account_id, from_date, to_date, delete=True):
"to": to_date,
})
- transaction_list = Transaction.objects.filter(
+ transaction_query = Transaction.objects.filter(
account_number=account.account_number,
created__gte=from_date,
created__lt=(to_date + relativedelta(days=1)))
@@ -289,7 +289,7 @@ def archive_transactions(account_id, from_date, to_date, delete=True):
yield sep
bucket = Bucket('billing.archive')
- chunks = generate_chunks(transaction_list)
+ chunks = generate_chunks(transaction_query.iterator())
archive = TransactionArchive(
account=account, filename=filename,
@@ -305,7 +305,7 @@ def archive_transactions(account_id, from_date, to_date, delete=True):
archive.save()
if delete:
- transaction_list.delete()
+ transaction_query.delete()
archive.status = TransactionArchive.STATUS_ARCHIVE_COMPLETED
archive.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment