Skip to content

Commit

Permalink
Fix download data not working
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn committed Aug 8, 2024
1 parent 70b7d96 commit 6e07b03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backend/src/appointment/controller/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def model_to_csv_buffer(models):
"""Dumps a DeclarationBase model to csv and returns an in-memory buffer"""
if len(models) == 0:
if len(models) == 0 or not models[0]:
return StringIO()

# Don't write out these columns
Expand Down Expand Up @@ -46,7 +46,9 @@ def download(db, subscriber: Subscriber):
schedules = repo.schedule.get_by_subscriber(db, subscriber.id)
availability = [repo.schedule.get_availability(db, schedule.id) for schedule in schedules]
invite = repo.invite.get_by_subscriber(db, subscriber.id)
waiting_list = invite.waiting_list
waiting_list = None
if invite:
waiting_list = invite.waiting_list

# Convert models to csv
attendee_buffer = model_to_csv_buffer(attendees)
Expand Down

0 comments on commit 6e07b03

Please sign in to comment.