File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ import lib
2+
3+
4+ QUERY_PATH = 'queries/contributions/weekly.gql'
5+
6+
7+ def process_weeks (value ):
8+ year_of_weeks = value ['contributionCalendar' ]['weeks' ]
9+
10+ out_days = {}
11+ for week in year_of_weeks :
12+ for day in week ['contributionDays' ]:
13+ date = day ['date' ]
14+ count = day ['contributionCount' ]
15+ out_days [date ] = count
16+
17+ return out_days
18+
19+
20+ def process ():
21+ resp_data = lib .query_by_filename (QUERY_PATH )
22+
23+ user_years = resp_data ['viewer' ]
24+ # We don't actually care about the year keys, as the dates are in granualar data.
25+ contributions_by_year = [process_weeks (v ) for v in user_years .values ()]
26+ all_contributions = {}
27+ for year in contributions_by_year :
28+ all_contributions .update (** year )
29+
30+ return all_contributions
31+
32+
33+ def main ():
34+ all_contributions = process ()
35+ for k in sorted (all_contributions ):
36+ print (k , all_contributions [k ])
37+
38+
39+ if __name__ == '__main__' :
40+ main ()
You can’t perform that action at this time.
0 commit comments