Skip to content

Commit

Permalink
updated csv for forms (#818)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsNyl authored Aug 18, 2024
1 parent f086ac2 commit ec03558
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/forms/csv_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@


class SubmissionsCsvWriter:
field_names = ["first_name", "last_name", "email"]
field_names = [
"first_name",
"last_name",
"full_name",
"email",
"study",
"studyyear",
]

def __init__(self, queryset=None):
if queryset is None:
Expand All @@ -27,7 +34,12 @@ def write_csv(self):
def create_row(self, result, submission):
user = submission.user
row = OrderedDict(
first_name=user.first_name, last_name=user.last_name, email=user.email
first_name=user.first_name,
last_name=user.last_name,
full_name=f"{user.first_name} {user.last_name}",
email=user.email,
study=user.study.group.name,
studyyear=user.studyyear.group.name,
)
for answer in submission.answers.all().prefetch_related(
"selected_options", "field"
Expand Down

0 comments on commit ec03558

Please sign in to comment.