mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 13:38:12 +02:00
apparently some dates are now parsed correctly
when the json is parsed, but others are still in string form, so i'm trying to account for that
This commit is contained in:
@ -26,8 +26,27 @@ def has_only_1_round_of_comments(commits, comments):
|
|||||||
if not comments or not commits:
|
if not comments or not commits:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
commit_dates = [parse_date(c.commit.author.date) for c in commits]
|
commit_dates = []
|
||||||
comment_dates = [parse_date(c.created_at) for c in comments]
|
for commit in commits:
|
||||||
|
if isinstance(commit.commit.author.date, str):
|
||||||
|
commit_dates.append(parse_date(commit.commit.author.date))
|
||||||
|
elif isinstance(commit.commit.author.date, datetime):
|
||||||
|
commit_dates.append(commit.commit.author.date)
|
||||||
|
else:
|
||||||
|
logging.warning(f"The commit {commit.sha} has an unexpected date format: {commit.commit.author.date}")
|
||||||
|
logging.warning(f"Tied to PR: {comments[0]['pull_request_url']}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
comment_dates = []
|
||||||
|
for comment in comments:
|
||||||
|
if isinstance(comment.created_at, str):
|
||||||
|
comment_dates.append(parse_date(comment.created_at))
|
||||||
|
elif isinstance(comment.created_at, datetime):
|
||||||
|
comment_dates.append(comment.created_at)
|
||||||
|
else:
|
||||||
|
logging.warning(f"The comment {comment['id']} has an unexpected date format: {comment['created_at']}")
|
||||||
|
logging.warning(f"Tied to PR: {comment['pull_request_url']}")
|
||||||
|
return False
|
||||||
|
|
||||||
commit_dates.sort()
|
commit_dates.sort()
|
||||||
comment_dates.sort()
|
comment_dates.sort()
|
||||||
|
Reference in New Issue
Block a user