From 98d820292fe23f65e52baba13e34b8dd91f8afe5 Mon Sep 17 00:00:00 2001 From: farhaanbukhsh Date: Mar 07 2016 17:58:17 +0000 Subject: Add list comprehension Fix notification count in comment --- diff --git a/pagure/lib/model.py b/pagure/lib/model.py index b6e0cb6..bb06e28 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -897,6 +897,12 @@ class PullRequest(BASE): ''' return self.remote_git is not None + @property + def user_comments(self): + ''' Return user comments only, filter it from notifications + ''' + return [comment for comment in self.comments if not comment.notification] + def to_json(self, public=False, api=False, with_comments=True): ''' Returns a dictionnary representation of the pull-request. diff --git a/pagure/templates/requests.html b/pagure/templates/requests.html index 4e79c11..d2ad8a7 100644 --- a/pagure/templates/requests.html +++ b/pagure/templates/requests.html @@ -73,12 +73,12 @@ repo=repo.name, requestid=request.id) }}"> PR#{{ request.id }} {% if status|lower != 'open' %}{{request.status}}{%endif%} {{ request.title | noJS("img") | safe }} - {% if request.comments|count > 0 %} + {% if request.user_comments|count > 0 %}    - {{request.comments|count}} + {{ request.user_comments|count }} {% endif %}