Skip to content

Commit

Permalink
Handles for variation in the node configs of a resource-instance or r…
Browse files Browse the repository at this point in the history
…esource-instance-list datatype, re #4357
  • Loading branch information
chiatt committed Dec 22, 2018
1 parent 915bb60 commit a31e626
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arches/app/models/mobile_survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ def serialize(self, fields=None, exclude=None):
break
if node['datatype'] == 'resource-instance' or node['datatype'] == 'resource-instance-list':
if node['config']['graphid'] is not None:
graph_id = node['config']['graphid'][0]
try:
graphuuid = uuid.UUID(node['config']['graphid'][0])
graph_id = unicode(graphuuid)
except ValueError as e:
graphuuid = uuid.UUID(node['config']['graphid'])
graph_id = unicode(graphuuid)
node['config']['options'] = []
for resource_instance in Resource.objects.filter(graph_id=graph_id):
node['config']['options'].append({'id': str(resource_instance.pk), 'name': resource_instance.displayname})
Expand Down

0 comments on commit a31e626

Please sign in to comment.