Skip to content

Commit b630814

Browse files
authored
[FIX] Applicant address bug (#3308)
put in some null checks for an optional address
1 parent e48bf3c commit b630814

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/core-api/app/api/projects/project_summary/models/project_summary.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class ProjectSummary(SoftDeleteMixin, AuditMixin, Base):
144144
def __get_address_type_code(cls, address_data):
145145
if isinstance(address_data, list):
146146
return address_data[0].get('address_type_code')
147-
return address_data.get('address_type_code')
147+
return address_data.get('address_type_code', None) if address_data else None
148148

149149
def __repr__(self):
150150
return f'{self.__class__.__name__} {self.project_summary_id}'
@@ -297,7 +297,7 @@ def create_or_update_party(cls, party_data, job_title_code, existing_party):
297297
address_type_code=addr.get('address_type_code'),
298298
)
299299
new_party.address.append(new_address)
300-
else:
300+
elif address_data is not None:
301301
new_address = Address.create(
302302
suite_no=address_data.get('suite_no'),
303303
address_line_1=address_data.get('address_line_1'),

0 commit comments

Comments
 (0)