diff --git a/gm_pr/models.py b/gm_pr/models.py index 9bdce79..158e5fb 100644 --- a/gm_pr/models.py +++ b/gm_pr/models.py @@ -16,7 +16,7 @@ class Pr: """ Simple class wrapper for pr properties """ - def __init__(self, url="", title="", updated_at="", user="", my_open_comments=0, + def __init__(self, url="", title="", updated_at="", user="", my_open_comment_count=0, repo="", nbreview=0, feedback_ok=0, feedback_weak=0, feedback_ko=0, milestone=None, labels=None, is_old=False): @@ -24,7 +24,7 @@ def __init__(self, url="", title="", updated_at="", user="", my_open_comments=0, self.title = title self.updated_at = updated_at self.user = user - self.my_open_comments = my_open_comments + self.my_open_comment_count = my_open_comment_count self.repo = repo self.nbreview = nbreview self.feedback_ok = feedback_ok diff --git a/gm_pr/prfetcher.py b/gm_pr/prfetcher.py index b944ecf..25cfebe 100644 --- a/gm_pr/prfetcher.py +++ b/gm_pr/prfetcher.py @@ -84,9 +84,9 @@ def fetch_data(repo_name, url, org, current_user): # look for tags only in main conversation and not in "file changed" if current_user is not None: - my_open_comments = get_open_comment_count(json_pr['review_comments_url'], current_user) + my_open_comment_count = get_open_comment_count(json_pr['review_comments_url'], current_user) else: - my_open_comments = 0 + my_open_comment_count = 0 for jcomment in conversation_json: body = jcomment['body'] if re.search(settings.FEEDBACK_OK['keyword'], body): @@ -102,7 +102,7 @@ def fetch_data(repo_name, url, org, current_user): title=json_pr['title'], updated_at=date, user=json_pr['user']['login'], - my_open_comments=my_open_comments, + my_open_comment_count=my_open_comment_count, repo=json_pr['base']['repo']['full_name'], nbreview=int(detail_json['comments']) + int(detail_json['review_comments']), @@ -123,13 +123,13 @@ def fetch_data(repo_name, url, org, current_user): # Return the number of non-obsolete review comments posted on the given PR url, by the given user. def get_open_comment_count(url, user): - open_comments=0 + open_comment_count=0 review_comments = paginablejson.PaginableJson(url) for review_comment in review_comments: # In obsolote comments, the position is None if review_comment['position'] is not None and review_comment['user']['login'] == user: - open_comments +=1 - return open_comments + open_comment_count +=1 + return open_comment_count class PrFetcher: diff --git a/gm_pr/static/gm_pr.css b/gm_pr/static/gm_pr.css index dc2f613..ca5e8dd 100644 --- a/gm_pr/static/gm_pr.css +++ b/gm_pr/static/gm_pr.css @@ -108,7 +108,7 @@ td a:hover { text-align: center; width: 1.5em; } -.my-open-comments{ +.my-open-comment-count{ color: black; text-align: center; width: 1.5em; diff --git a/gm_pr/templates/pr.html b/gm_pr/templates/pr.html index baff947..1456955 100644 --- a/gm_pr/templates/pr.html +++ b/gm_pr/templates/pr.html @@ -55,9 +55,9 @@ {{pr.user}} {{pr.nbreview}} {% if request.GET.login %} - - {% if pr.my_open_comments > 0 %} - {{pr.my_open_comments}} + + {% if pr.my_open_comment_count > 0 %} + {{pr.my_open_comment_count}} {% endif %} {% endif %}