Skip to content

Commit

Permalink
Find differences
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Oct 15, 2024
1 parent 44c1882 commit 9b2d405
Show file tree
Hide file tree
Showing 4 changed files with 19,534 additions and 1,217 deletions.
27 changes: 14 additions & 13 deletions find-differences.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@
with open('gh-data-summary.json', 'r') as json_file:
gh_data_summary = json.load(json_file)

# Create a dictionary with 'title' as key for easy lookup
gh_data_dict = {item['title']: item for item in gh_data_summary}
# Create a dictionary with 'issue' as key for easy lookup in gh-data-summary.json
gh_data_dict = {item['issue']: item for item in gh_data_summary}

# Function to compare two dictionaries and return differences
def compare_dicts(dict1, dict2):
# Function to compare the 'position' key between two dictionaries
def compare_position(dict1, dict2):
differences = {}
for key in dict1:
if key in dict2:
if dict1[key] != dict2[key]:
differences[key] = {'activities.yml': dict1[key], 'gh-data-summary.json': dict2[key]}
if 'position' in dict1 and 'position' in dict2:
if dict1['position'] != dict2['position']:
differences['position'] = {'activities.yml': dict1['position'], 'gh-data-summary.json': dict2['position']}
return differences

# Compare the files and find differences
# Compare the files and find differences in 'position' using 'issue' as the key
differences = {}
for activity_title, activity_data in activities.items():
if activity_title in gh_data_dict:
diff = compare_dicts(activity_data, gh_data_dict[activity_title])
if diff:
differences[activity_title] = diff
if 'issue' in activity_data:
issue_number = activity_data['issue']
if issue_number in gh_data_dict:
diff = compare_position(activity_data, gh_data_dict[issue_number])
if diff:
differences[issue_number] = diff

# Output the differences as JSON
print(json.dumps(differences, indent=4))
Loading

0 comments on commit 9b2d405

Please sign in to comment.