Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed TypeError when commit is being null. #464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sources/manager_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class EnvironmentManager:
LOCALE = getenv("INPUT_LOCALE", "en")
UPDATED_DATE_FORMAT = getenv("INPUT_UPDATED_DATE_FORMAT", "%d/%m/%Y %H:%M:%S")
IGNORED_REPOS = getenv("INPUT_IGNORED_REPOS", "").replace(" ", "").split(",")
SYMBOL_VERSION = int(getenv("INPUT_SYMBOL_VERSION"))
SYMBOL_VERSION = int(getenv("INPUT_SYMBOL_VERSION", 1))

DEBUG_LOGGING = getenv("INPUT_DEBUG_LOGGING", "0").lower() in _TRUTHY
DEBUG_RUN = getenv("DEBUG_RUN", "False").lower() in _TRUTHY
35 changes: 18 additions & 17 deletions sources/yearly_commit_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,26 @@ async def update_data_with_commit_stats(repo_details: Dict, yearly_data: Dict, d
for branch in branch_data["data"]["repository"]["refs"]["nodes"]:
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"]:
date = search(r"\d+-\d+-\d+", commit["committedDate"]).group()
curr_year = datetime.fromisoformat(date).year
quarter = (datetime.fromisoformat(date).month - 1) // 3 + 1
if commit:
date = search(r"\d+-\d+-\d+", commit["committedDate"]).group()
curr_year = datetime.fromisoformat(date).year
quarter = (datetime.fromisoformat(date).month - 1) // 3 + 1

if repo_details["name"] not in date_data:
date_data[repo_details["name"]] = dict()
if branch["name"] not in date_data[repo_details["name"]]:
date_data[repo_details["name"]][branch["name"]] = dict()
date_data[repo_details["name"]][branch["name"]][commit["oid"]] = commit["committedDate"]
if repo_details["name"] not in date_data:
date_data[repo_details["name"]] = dict()
if branch["name"] not in date_data[repo_details["name"]]:
date_data[repo_details["name"]][branch["name"]] = dict()
date_data[repo_details["name"]][branch["name"]][commit["oid"]] = commit["committedDate"]

if repo_details["primaryLanguage"] is not None:
if curr_year not in yearly_data:
yearly_data[curr_year] = dict()
if quarter not in yearly_data[curr_year]:
yearly_data[curr_year][quarter] = dict()
if repo_details["primaryLanguage"]["name"] not in yearly_data[curr_year][quarter]:
yearly_data[curr_year][quarter][repo_details["primaryLanguage"]["name"]] = {"add": 0, "del": 0}
yearly_data[curr_year][quarter][repo_details["primaryLanguage"]["name"]]["add"] += commit["additions"]
yearly_data[curr_year][quarter][repo_details["primaryLanguage"]["name"]]["del"] += commit["deletions"]
if repo_details["primaryLanguage"] is not None:
if curr_year not in yearly_data:
yearly_data[curr_year] = dict()
if quarter not in yearly_data[curr_year]:
yearly_data[curr_year][quarter] = dict()
if repo_details["primaryLanguage"]["name"] not in yearly_data[curr_year][quarter]:
yearly_data[curr_year][quarter][repo_details["primaryLanguage"]["name"]] = {"add": 0, "del": 0}
yearly_data[curr_year][quarter][repo_details["primaryLanguage"]["name"]]["add"] += commit["additions"]
yearly_data[curr_year][quarter][repo_details["primaryLanguage"]["name"]]["del"] += commit["deletions"]

if not EM.DEBUG_RUN:
await sleep(0.4)
Loading