Skip to content

Commit

Permalink
fix OARec contact object
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Oct 13, 2023
1 parent d3e3d14 commit fc6146c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pygeometa/schemas/ogcapi_records/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ def generate_party(self, contact: dict,
organization_name = get_charstring(contact.get('organization'),
self.lang1, self.lang2)

individual_name = get_charstring(contact.get('individualname'),
self.lang1, self.lang2)

position_name = get_charstring(contact.get('positionname'),
self.lang1, self.lang2)

Expand Down Expand Up @@ -290,14 +293,14 @@ def generate_party(self, contact: dict,
'roles': []
}

if organization_name[0] == contact.get('organization'):
LOGGER.debug('Contact name is organization')
rp['name'] = organization_name[0]

if organization_name[0] is not None:
rp['organization'] = organization_name[0]
if individual_name[0] is not None:
rp['name'] = individual_name[0]
if position_name[0] is not None:
rp['positionName'] = position_name[0]
rp['position'] = position_name[0]
if hours_of_service[0] is not None:
rp['positionName'] = hours_of_service[0]
rp['hoursOfService'] = hours_of_service[0]
if contact_instructions[0] is not None:
rp['contactInstructions'] = contact_instructions[0]

Expand All @@ -319,6 +322,7 @@ def generate_party(self, contact: dict,
phone = phone.replace('+0', '+').replace(' ', '')

rp['phones'] = [{'value': phone}]

if contact.get('email') is not None:
rp['emails'] = [{'value': contact.get('email')}]

Expand Down

0 comments on commit fc6146c

Please sign in to comment.