Simplify pass of counts
- Legacy-Id: 10527
This commit is contained in:
parent
a4561f55f2
commit
2a63f91d31
|
@ -10,8 +10,7 @@ from ietf.utils.log import log
|
|||
from ietf.doc.templatetags.ietf_filters import wrap_text
|
||||
|
||||
from ietf.person.models import Person
|
||||
from ietf.nomcom.models import Feedback
|
||||
from ietf.nomcom.utils import get_nomcom_by_year, get_user_email, retrieve_nomcom_private_key
|
||||
from ietf.nomcom.utils import get_nomcom_by_year, retrieve_nomcom_private_key
|
||||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
|
@ -34,9 +33,7 @@ def has_publickey(nomcom):
|
|||
|
||||
@register.simple_tag
|
||||
def add_num_nominations(counts, position, nominee):
|
||||
count = 0
|
||||
if position.id in counts and nominee.id in counts[position.id]:
|
||||
count = counts[position.id][nominee.id]
|
||||
count = counts.get((position.id,nominee.id),0)
|
||||
if count:
|
||||
return '<span class="badge" title="%s earlier comments from you on %s as %s">%s</span> ' % (count , nominee.email.address, position, count)
|
||||
else:
|
||||
|
|
|
@ -392,10 +392,7 @@ def feedback(request, year, public):
|
|||
user_comments = Feedback.objects.filter(nomcom=nomcom,
|
||||
type='comment',
|
||||
author__in=request.user.person.email_set.filter(active='True'))
|
||||
counter = Counter(user_comments.values_list('positions','nominees'))
|
||||
counts = dict()
|
||||
for pos,nom in counter:
|
||||
counts.setdefault(pos,dict())[nom] = counter[(pos,nom)]
|
||||
counts = Counter(user_comments.values_list('positions','nominees'))
|
||||
|
||||
if public:
|
||||
base_template = "nomcom/nomcom_public_base.html"
|
||||
|
|
Loading…
Reference in a new issue