Skip to content

Commit

Permalink
Merge pull request #47 from GenomicDataInfrastructure/refactor-with-u…
Browse files Browse the repository at this point in the history
…rl-labels

fix empty values handling
  • Loading branch information
hcvdwerf authored Apr 16, 2024
2 parents 69455ec + 4b78563 commit 940df07
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ckanext/gdi_userportal/logic/action/translation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ def replace_package(data, translation_dict):
def _translate_fields(data, fields_list, translation_dict):
for field in fields_list:
value = data.get(field)
new_value = None
if value:
if isinstance(value, List):
new_value = [ValueLabel(name=x, display_name=translation_dict.get(x, x)).__dict__ for x in value]
else:
new_value = ValueLabel(name=value, display_name=translation_dict.get(value, value)).__dict__
data[field] = new_value
data[field] = new_value
return data


Expand Down

0 comments on commit 940df07

Please sign in to comment.