Reverse reviews so latest it obtained

This commit is contained in:
Jake Howard 2019-03-06 10:03:32 +00:00
parent 9c311d0bf0
commit 02f1a80f9e
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -18,7 +18,7 @@ def pr_to_task_name(pr: PullRequest) -> str:
def get_my_review(me, pr: PullRequest): def get_my_review(me, pr: PullRequest):
for review in pr.get_reviews(): for review in pr.get_reviews().reversed:
if review.user.login == me.login: if review.user.login == me.login:
return review return review
@ -56,6 +56,7 @@ def todoist_repo_prs():
existing_task = todoist.items.get_by_id(existing_task_id) existing_task = todoist.items.get_by_id(existing_task_id)
task_completed = is_task_completed(existing_task) task_completed = is_task_completed(existing_task)
if my_review: if my_review:
print(pr, my_review, my_review.commit_id, pr.head.sha)
if my_review.commit_id == pr.head.sha and not task_completed: if my_review.commit_id == pr.head.sha and not task_completed:
logger.info( logger.info(
"Completing task to review '{}', because I already did it".format( "Completing task to review '{}', because I already did it".format(