Skip to content

Commit

Permalink
omit note question type from exports only
Browse files Browse the repository at this point in the history
  • Loading branch information
RuthShryock committed May 24, 2024
1 parent ee21e86 commit 6ed2e5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions kpi/models/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,10 @@ def adjust_content_on_save(self):
# Remove newlines and tabs (they are stripped in front end anyway)
self.name = re.sub(r'[\n\t]+', '', _title)

def analysis_form_json(self):
def analysis_form_json(self, omit_question_types=None):
if omit_question_types is None:
omit_question_types = []

additional_fields = list(self._get_additional_fields())
engines = dict(self._get_engines())
output = {'engines': engines, 'additional_fields': additional_fields}
Expand Down Expand Up @@ -502,8 +505,7 @@ def analysis_form_json(self):
settings='??',
path=[qpath, qual_question['uuid']],
)
if field['type'] == 'qual_note':
# don't include note question type in exports
if field['type'] in omit_question_types:
continue
try:
field['choices'] = qual_question['choices']
Expand Down
4 changes: 3 additions & 1 deletion kpi/models/import_export_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,9 @@ def get_export_object(
)

if source.has_advanced_features:
pack.extend_survey(source.analysis_form_json())
pack.extend_survey(
source.analysis_form_json(omit_question_types=['qual_note'])
)

# Wrap the submission stream in a generator that records the most
# recent timestamp
Expand Down

0 comments on commit 6ed2e5b

Please sign in to comment.