Skip to content

Commit

Permalink
Export only donations for the current year
Browse files Browse the repository at this point in the history
  • Loading branch information
danniel authored and tudoramariei committed Feb 21, 2024
1 parent 15fc93a commit 6f64d81
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backend/donations/views/donations_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ def download_donations_job(job_id: int = 0):
return

ngo: Ngo = job.ngo
# TODO: Shouldn't we download only donations from the current year? Or the current+previous year?
donations: QuerySet[Donor] = Donor.objects.filter(ngo=ngo, has_signed=True).all()
ts = timezone.now()
donations: QuerySet[Donor] = Donor.objects.filter(
ngo=ngo,
has_signed=True,
date_created__gte=datetime(year=ts.year, month=1, day=1, hour=0, minute=0, second=0, tzinfo=ts.tzinfo),
).all()

try:
zip_byte_stream: io.BytesIO = _package_donations(donations, job, ngo)
Expand Down

0 comments on commit 6f64d81

Please sign in to comment.