Skip to content

Commit 948b458

Browse files
committed
[#100] Construct org location titles properly in 360Giving template
1 parent f5f7e00 commit 948b458

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

flattentool/schema.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def parse(self):
9999
else:
100100
self.main_sheet.append(field)
101101

102-
def parse_schema_dict(self, parent_path, schema_dict, parent_id_fields=None, title_lookup=None):
102+
def parse_schema_dict(self, parent_path, schema_dict, parent_id_fields=None, title_lookup=None, parent_title=''):
103103
if parent_path:
104104
parent_path = parent_path + '/'
105105
parent_id_fields = parent_id_fields or []
@@ -127,7 +127,8 @@ def parse_schema_dict(self, parent_path, schema_dict, parent_id_fields=None, tit
127127
parent_path+property_name,
128128
property_schema_dict,
129129
parent_id_fields=id_fields,
130-
title_lookup=title_lookup.get(title)):
130+
title_lookup=title_lookup.get(title),
131+
parent_title=parent_title+title+':' if title else None):
131132
yield (
132133
property_name+'/'+field,
133134
# TODO ambiguous use of "title"
@@ -165,7 +166,8 @@ def parse_schema_dict(self, parent_path, schema_dict, parent_id_fields=None, tit
165166
parent_path+property_name+'/0',
166167
property_schema_dict['items'],
167168
parent_id_fields=id_fields,
168-
title_lookup=title_lookup.get(title))
169+
title_lookup=title_lookup.get(title),
170+
parent_title=parent_title+title+':' if title else None)
169171

170172
rolledUp = set()
171173

@@ -177,9 +179,7 @@ def parse_schema_dict(self, parent_path, schema_dict, parent_id_fields=None, tit
177179
warn('Field {} does not have a title, skipping it and all its children.'.format(property_name))
178180
else:
179181
# This code only works for arrays that are at 0 or 1 layer of nesting
180-
print(parent_path)
181-
assert parent_path == ''
182-
sub_sheet.add_field(title+':'+child_title)
182+
sub_sheet.add_field(parent_title+title+':'+child_title)
183183
else:
184184
sub_sheet.add_field(parent_path+property_name+'/0/'+field)
185185
if self.rollup and 'rollUp' in property_schema_dict and field in property_schema_dict['rollUp']:

0 commit comments

Comments
 (0)