|
85 | 85 | # Look for a similar existing item from a newer CodeMeta version |
86 | 86 | for existing_item in json_items: |
87 | 87 | if existing_item.items() >= item.items(): |
88 | | - # We found an existing item, add this version to its list |
| 88 | + # We found an identical existing item, add this version to its list |
89 | 89 | assert ( |
90 | 90 | version not in existing_item["versions"] |
91 | 91 | ), f"CodeMeta {version} has duplicated property {item}" |
92 | 92 | existing_item["versions"].append(version) |
93 | | - |
94 | | - # values from newer versions of properties_description.json take precedence |
95 | | - # over new ones |
96 | | - if item["Type"]: |
97 | | - existing_item["Type"] = item["Type"] |
98 | | - if item["Description"]: |
99 | | - existing_item["Description"] = item["Description"] |
| 93 | + # check for existing properties that have differing types or descriptions |
| 94 | + # values from newer versions of properties_description.json take precedence |
| 95 | + # over new ones. |
| 96 | + # update the versions for these here and break to avoid duplicate rows |
| 97 | + if item["Property"] == existing_item["Property"]: |
| 98 | + if item["Type"] != existing_item["Type"]: |
| 99 | + item["Type"] = existing_item["Type"] |
| 100 | + if version not in existing_item["versions"]: |
| 101 | + existing_item["versions"].append(version) |
| 102 | + if item["Description"] != existing_item["Description"]: |
| 103 | + item["Description"] = existing_item["Description"] |
| 104 | + if version not in existing_item["versions"]: |
| 105 | + existing_item["versions"].append(version) |
100 | 106 | break |
| 107 | + |
101 | 108 | else: |
102 | 109 | # No similar item, create a new one |
103 | 110 | item["versions"] = [version] |
|
0 commit comments