Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch the assert error #888

Merged
merged 2 commits into from
Jan 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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