Skip to content

Commit

Permalink
Merge pull request #4941 from kobotoolbox/remove-note-question-type
Browse files Browse the repository at this point in the history
Remove the Note qualitative analysis question type from exports
  • Loading branch information
jnm committed May 24, 2024
2 parents b3e7b7d + 6ed2e5b commit b1559d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion 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,6 +505,8 @@ def analysis_form_json(self):
settings='??',
path=[qpath, qual_question['uuid']],
)
if field['type'] in omit_question_types:
continue
try:
field['choices'] = qual_question['choices']
except KeyError:
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 b1559d3

Please sign in to comment.