Skip to content

Commit

Permalink
Merge pull request #5499 from bcgov/dev-MD-3622
Browse files Browse the repository at this point in the history
3622 - Handle documents with no attributes present
  • Loading branch information
milosdes authored Dec 31, 2024
2 parents 975b07d + e3e9e0d commit f106cb0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions request-management-api/request_api/services/recordservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ def updatepersonalattributes(self, requestid, ministryrequestid, requestdata, us
record['attributes'] = json.loads(record['attributes'])
for attribute in requestdata['newpersonalattributes']:
if (requestdata['newpersonalattributes'][attribute] is not None and len(requestdata['newpersonalattributes'][attribute]) > 0):
if 'attributes' in record:
if 'personalattributes' in record['attributes']:
record['attributes']['personalattributes'][attribute] = requestdata['newpersonalattributes'][attribute]
else:
record['attributes']['personalattributes'] = {}
else:
record['attributes'] = {}
record['attributes']['personalattributes'] = {}
record['attributes']['personalattributes'][attribute] = requestdata['newpersonalattributes'][attribute]
# divisions = divisions + [div for div in record['attributes']['divisions'] if div not in divisions]
record.update({'updated_at': datetime.now(), 'updatedby': userid})
Expand Down

0 comments on commit f106cb0

Please sign in to comment.