Skip to content
Snippets Groups Projects

automatically determine number of custom questions

1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
+ 5
5
@@ -61,18 +61,18 @@ class Signup:
def process(reader: csv.reader) -> Dict[str, List[Signup]]:
event_data = collections.defaultdict(list)
all_by_mail = collections.defaultdict(list)
number_of_custom_questions = sum(
1 for fieldname in reader.fieldnames if fieldname.startswith('Question ')
)
for linenum, line in enumerate(reader):
date, slot = line['Start Date & Time'].split(' ')
assert date == DATE, date
exams = []
for i in range(1, 5):
for i in range(1, number_of_custom_questions + 1):
key = f'Response {i}'
if key in line:
exams += line[key].split('\n')
elif linenum == 1:
print(f"!!! No {key} key in export!")
exams += line[key].split('\n')
exams = [e for e in exams if e]
lastname = line['Invitee Last Name']
Loading