Skip to content

Commit

Permalink
move deletion to outside the condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Wambere committed Apr 25, 2024
1 parent 1fc65e8 commit f3beb92
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions importer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,6 @@ def group_extras(resource, payload_string, group_type):
else:
del_indexes.append(GROUP_INDEX_MAPPING["product_image_index"])

for x in reversed(del_indexes):
del payload_obj["resource"]["characteristic"][x]

elif group_type == "inventory":
(
_,
Expand Down Expand Up @@ -732,12 +729,12 @@ def group_extras(resource, payload_string, group_type):
else:
del_indexes.append(GROUP_INDEX_MAPPING["inventory_donor_index"])

for x in reversed(del_indexes):
del payload_obj["resource"]["characteristic"][x]

else:
logging.info("Group type not defined")

for x in reversed(del_indexes):
del payload_obj["resource"]["characteristic"][x]

payload_string = json.dumps(payload_obj, indent=4)
return payload_string

Expand Down

0 comments on commit f3beb92

Please sign in to comment.