Skip to content

Commit

Permalink
Instead of loading groups as questions, extract their sub-fields and …
Browse files Browse the repository at this point in the history
…load these a questions

Typo

Typo
  • Loading branch information
ChrisCoffey committed Jul 19, 2021
1 parent 323a987 commit 248d46b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tap_typeform/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,19 @@ def sync_form_definition(atx, form_id):
# we only care about a few fields in the form definition
# just those that give an analyst a reference to the submissions
for row in data:
definition_data_rows.append({
"form_id": form_id,
"question_id": row['id'],
"title": row['title'],
"ref": row['ref']
})
# Groups aren't questions themselves, but they contain one or
# more questions. So extract them and add them to the back of the
# fields queue
if row['type'] == 'group':
sub_questions = row['properties']['fields']
data += sub_questions
else:
definition_data_rows.append({
"form_id": form_id,
"question_id": row['id'],
"title": row['title'],
"ref": row['ref']
})

write_records(atx, 'questions', definition_data_rows)

Expand Down

0 comments on commit 248d46b

Please sign in to comment.