bounties.py 943 B

1234567891011121314151617181920212223242526272829303132333435
  1. import json
  2. def main():
  3. data = dict()
  4. with open("reports.json","r") as fp:
  5. data = json.load(fp)
  6. reports_id = dict()
  7. reports_team = dict()
  8. teams = []
  9. sum_team = dict()
  10. flag = True
  11. for chunk in data:
  12. for page_id in chunk:
  13. for report in chunk[page_id]:
  14. reports_id[report['id']] = report
  15. team = report['team']['handle']
  16. if team in reports_team:
  17. reports_team[team].append(report)
  18. else:
  19. teams.append(team)
  20. reports_team[team] = []
  21. reports_team[team].append(report)
  22. for team in reports_team:
  23. sum_team[team] = len(reports_team[team])
  24. with open("reports_team.json", "w") as fp:
  25. json.dump(reports_team, fp)
  26. with open("sum_team.json", "w") as fp:
  27. json.dump(sum_team, fp)
  28. if __name__ == "__main__":
  29. main()