Skip to content

Commit

Permalink
Merge pull request #888 from onaio/1330-csv-export-fix
Browse files Browse the repository at this point in the history
catch the assert error
  • Loading branch information
denniswambua authored Jan 31, 2017
2 parents b803532 + 425a8f2 commit cdde216
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions onadata/libs/utils/csv_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,18 +340,13 @@ def _reindex(cls, key, value, ordered_columns, row, data_dictionary,
"""
def get_ordered_repeat_value(xpath, repeat_value):
children = data_dictionary.get_child_elements(xpath)
count_keys = len(repeat_value.keys())
item = OrderedDict()

for elem in children:
xp = elem.get_abbreviated_xpath()
if xp in repeat_value:
item[xp] = repeat_value[xp]

count_ordered = len(item.keys())
assert count_keys == count_ordered, \
"Only %s of %s were found" % (count_ordered, count_keys)

return item

d = {}
Expand All @@ -367,6 +362,7 @@ def get_ordered_repeat_value(xpath, repeat_value):
if type(item) is dict:
# order repeat according to xform order
item = get_ordered_repeat_value(key, item)

for nested_key, nested_val in item.iteritems():
# given the key "children/details" and nested_key/
# abbreviated xpath
Expand Down

0 comments on commit cdde216

Please sign in to comment.