mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 17:38:50 -04:00
Fix issue with looping in list merging
The last_dest_idx variable should always have been tracking the last index in the source list. The original intention, implemented incorrectly, was to just append any items which source has no item at that index.
This commit is contained in:
@@ -651,9 +651,9 @@ def merge_jsonlike(source, destination):
|
||||
return True
|
||||
|
||||
def merge_lists(source, destination):
|
||||
last_dest_idx = len(destination) - 1
|
||||
last_src_idx = len(source) - 1
|
||||
for idx, item in enumerate(destination):
|
||||
if idx <= last_dest_idx:
|
||||
if idx <= last_src_idx:
|
||||
# assign destination value if can't be merged into source
|
||||
if merge_items(source[idx], destination[idx]) is False:
|
||||
source[idx] = destination[idx]
|
||||
|
||||
Reference in New Issue
Block a user