Skip to content

Commit

Permalink
xxx
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmajoor committed Dec 6, 2024
1 parent 15e357f commit c18a080
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions binder/plugins/views/csvexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,20 @@ def get_datum(data, key, prefix=''):

if fk_ids is None:
# This case happens if we have a nullable foreign key that is null. Treat this as a many
# to one relation with no values.
# to one relation with no values.
fk_ids = []
elif type(fk_ids) != list:
fk_ids = [fk_ids]

# if head_key not in key_mapping:
prefix_key = parent_data['with_mapping'][new_prefix[1:]]
datums = [str(get_datum(key_mapping[prefix_key][fk_id], subkey, new_prefix)) for fk_id in fk_ids]
datums = []
for fk_id in fk_ids:
try:
datums.append(str(get_datum(key_mapping[prefix_key][fk_id], subkey, new_prefix)))
except KeyError:
pass
# datums = [str(get_datum(key_mapping[prefix_key][fk_id], subkey, new_prefix)) for fk_id in fk_ids]
return self.csv_settings.multi_value_delimiter.join(
datums
)
Expand Down

0 comments on commit c18a080

Please sign in to comment.