Skip to content

Commit

Permalink
Issue #5: rename "my_open_comments" to "my_open_comment_count" everyw…
Browse files Browse the repository at this point in the history
…here.
  • Loading branch information
caarmen committed Aug 22, 2015
1 parent 90fb9ff commit a888865
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions gm_pr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
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):
self.url = url
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
Expand Down
12 changes: 6 additions & 6 deletions gm_pr/prfetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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']),
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gm_pr/static/gm_pr.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions gm_pr/templates/pr.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
<td class="user">{{pr.user}}</td>
<td class="nbrev">{{pr.nbreview}}</td>
{% if request.GET.login %}
<td class="my-open-comments">
{% if pr.my_open_comments > 0 %}
{{pr.my_open_comments}}
<td class="my-open-comment-count">
{% if pr.my_open_comment_count > 0 %}
{{pr.my_open_comment_count}}
{% endif %}
</td>
{% endif %}
Expand Down

0 comments on commit a888865

Please sign in to comment.