You've already forked wakapi-readme-stats
Fixed commit pagination code
This commit is contained in:
@@ -30,11 +30,10 @@ async def calculate_commit_data(repositories: Dict) -> Tuple[Dict, Dict]:
|
||||
|
||||
yearly_data = dict()
|
||||
date_data = dict()
|
||||
total = len(repositories["data"]["user"]["repositories"]["nodes"])
|
||||
for ind, repo in enumerate(repositories["data"]["user"]["repositories"]["nodes"]):
|
||||
for ind, repo in enumerate(repositories):
|
||||
if repo["name"] not in EM.IGNORED_REPOS:
|
||||
repo_name = "[private]" if repo["isPrivate"] else f"{repo['owner']['login']}/{repo['name']}"
|
||||
DBM.i(f"\t{ind + 1}/{total} Retrieving repo: {repo_name}")
|
||||
DBM.i(f"\t{ind + 1}/{len(repositories)} Retrieving repo: {repo_name}")
|
||||
await update_data_with_commit_stats(repo, yearly_data, date_data)
|
||||
DBM.g("Commit data calculated!")
|
||||
|
||||
@@ -56,13 +55,13 @@ async def update_data_with_commit_stats(repo_details: Dict, yearly_data: Dict, d
|
||||
"""
|
||||
owner = repo_details["owner"]["login"]
|
||||
branch_data = await DM.get_remote_graphql("repo_branch_list", owner=owner, name=repo_details["name"])
|
||||
if branch_data["data"]["repository"] is None:
|
||||
if len(branch_data) == 0:
|
||||
DBM.w(f"\t\tSkipping repo: {repo_details['name']}")
|
||||
return
|
||||
|
||||
for branch in branch_data["data"]["repository"]["refs"]["nodes"]:
|
||||
for branch in branch_data:
|
||||
commit_data = await DM.get_remote_graphql("repo_commit_list", owner=owner, name=repo_details["name"], branch=branch["name"], id=GHM.USER.node_id)
|
||||
for commit in commit_data["data"]["repository"]["ref"]["target"]["history"]["nodes"]:
|
||||
for commit in commit_data:
|
||||
date = search(r"\d+-\d+-\d+", commit["committedDate"]).group()
|
||||
curr_year = datetime.fromisoformat(date).year
|
||||
quarter = (datetime.fromisoformat(date).month - 1) // 3 + 1
|
||||
|
||||
Reference in New Issue
Block a user