Skip to content

Commit 28c8c5b

Browse files
authored
Merge pull request #752 from SmartThingsCommunity/bugfix/CHAD-10893-check-duplicate-profile-metadata
Check metadata when comparing profiles for duplicate detection
2 parents 019c340 + 0cd953b commit 28c8c5b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/scripts/check_duplicates.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ def compare_preferences(prof1, prof2):
6262
else:
6363
return False
6464

65+
def compare_metadata(prof1, prof2):
66+
if "metadata" in prof1 and "metadata" in prof2:
67+
return prof1["metadata"] == prof2["metadata"]
68+
elif "metadata" not in prof1 and "metadata" not in prof2:
69+
return True
70+
else:
71+
return False
72+
6573
def compare_components(prof1, prof2):
6674
if len(prof1["components"]) == len(prof2["components"]):
6775
for y, new_component in enumerate(prof1["components"]):
@@ -119,6 +127,7 @@ def compare_components(prof1, prof2):
119127
- preferences must be the same
120128
'''
121129
if(compare_preferences(new_profile_map, current_profile_map) == True and
130+
compare_metadata(new_profile_map, current_profile_map) == True and
122131
compare_components(new_profile_map, current_profile_map) == True):
123132
print("%s and %s are duplicates!\n" % (new_profile, current_profile))
124133
duplicate_pairs.append((new_profile, current_profile))

0 commit comments

Comments
 (0)