Skip to content

Commit

Permalink
Fixing emails count on area contribution chart of user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanP committed Dec 5, 2013
1 parent fa6c79f commit 9975ff6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def get_context_data(self, **kwargs):
'ticket': TicketCollabCount,
}

messages = Message.objects.filter(from_address__user__pk=user.pk)
for type in ['thread', 'ticket', 'wiki', 'changeset', 'attachment']:
CounterClass = counter_class.get(type)
if CounterClass:
Expand All @@ -80,6 +81,8 @@ def get_context_data(self, **kwargs):
count_types[trans(type)] = 0
else:
count_types[trans(type)] = counter.count
elif type == 'thread':
count_types[trans(type)] = messages.count()
else:
sqs = SearchQuerySet()
for filter_or in fields_or_lookup:
Expand All @@ -100,7 +103,6 @@ def get_context_data(self, **kwargs):
context['emails'] = query[:10]

count_by = 'thread__mailinglist__name'
messages = Message.objects.filter(from_address__user__pk=user.pk)
context['list_activity'] = dict(messages.values_list(count_by)\
.annotate(Count(count_by))\
.order_by(count_by))
Expand Down

0 comments on commit 9975ff6

Please sign in to comment.