Skip to content

Commit

Permalink
Remove qpath, use (x)path instead
Browse files Browse the repository at this point in the history
  • Loading branch information
noliveleger committed Sep 3, 2024
1 parent 451df4c commit eea375b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/formpack/schema/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ def __init__(
# do not include the root section in the path
self.path = '/'.join(info.name for info in self.hierarchy[1:])

@property
def qpath(self):
return self.path.replace('/', '-')

def get_labels(
self,
lang=UNSPECIFIED_TRANSLATION,
Expand Down Expand Up @@ -536,7 +532,7 @@ def get_value_from_entry(self, entry):
name = self.name.split('/')[-1]

try:
responses = entry['_supplementalDetails'][self.source_field.qpath][
responses = entry['_supplementalDetails'][self.source_field.path][
'qual'
]
except KeyError:
Expand Down Expand Up @@ -626,7 +622,7 @@ def get_value_from_entry(self, entry):
name = self.name.split('/')[-1]

try:
responses = entry['_supplementalDetails'][self.source_field.qpath]
responses = entry['_supplementalDetails'][self.source_field.path]
except KeyError:
return ''

Expand All @@ -653,7 +649,7 @@ def get_value_from_entry(self, entry):
name = self.name.split('/')[-1]

try:
responses = entry['_supplementalDetails'][self.source_field.qpath]
responses = entry['_supplementalDetails'][self.source_field.path]
except KeyError:
return ''

Expand Down
4 changes: 2 additions & 2 deletions src/formpack/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _map_sections_to_analysis_fields(
self, survey_field: FormField
) -> List[FormField]:
_fields = []
for analysis_field in self.fields_by_source[survey_field.qpath]:
for analysis_field in self.fields_by_source[survey_field.path]:
analysis_field.section = survey_field.section
analysis_field.source_field = survey_field
_fields.append(analysis_field)
Expand All @@ -141,7 +141,7 @@ def insert_analysis_fields(
_fields = []
for field in fields:
_fields.append(field)
if field.qpath in self.fields_by_source:
if field.path in self.fields_by_source:
_fields += self._map_sections_to_analysis_fields(field)
return _fields

Expand Down

0 comments on commit eea375b

Please sign in to comment.