Skip to content

Commit

Permalink
Check metadata when comparing profiles for duplicate detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ctowns committed Jun 5, 2023
1 parent 019c340 commit 0cd953b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/scripts/check_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ def compare_preferences(prof1, prof2):
else:
return False

def compare_metadata(prof1, prof2):
if "metadata" in prof1 and "metadata" in prof2:
return prof1["metadata"] == prof2["metadata"]
elif "metadata" not in prof1 and "metadata" not in prof2:
return True
else:
return False

def compare_components(prof1, prof2):
if len(prof1["components"]) == len(prof2["components"]):
for y, new_component in enumerate(prof1["components"]):
Expand Down Expand Up @@ -119,6 +127,7 @@ def compare_components(prof1, prof2):
- preferences must be the same
'''
if(compare_preferences(new_profile_map, current_profile_map) == True and
compare_metadata(new_profile_map, current_profile_map) == True and
compare_components(new_profile_map, current_profile_map) == True):
print("%s and %s are duplicates!\n" % (new_profile, current_profile))
duplicate_pairs.append((new_profile, current_profile))
Expand Down

0 comments on commit 0cd953b

Please sign in to comment.