Commit 9975ff625e95fe18f9703d0c15913feba5b3ee35

Authored by Luan
1 parent fa6c79ff

Fixing emails count on area contribution chart of user profile

Showing 1 changed file with 3 additions and 1 deletions   Show diff stats
src/accounts/views.py
... ... @@ -71,6 +71,7 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView):
71 71 'ticket': TicketCollabCount,
72 72 }
73 73  
  74 + messages = Message.objects.filter(from_address__user__pk=user.pk)
74 75 for type in ['thread', 'ticket', 'wiki', 'changeset', 'attachment']:
75 76 CounterClass = counter_class.get(type)
76 77 if CounterClass:
... ... @@ -80,6 +81,8 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView):
80 81 count_types[trans(type)] = 0
81 82 else:
82 83 count_types[trans(type)] = counter.count
  84 + elif type == 'thread':
  85 + count_types[trans(type)] = messages.count()
83 86 else:
84 87 sqs = SearchQuerySet()
85 88 for filter_or in fields_or_lookup:
... ... @@ -100,7 +103,6 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView):
100 103 context['emails'] = query[:10]
101 104  
102 105 count_by = 'thread__mailinglist__name'
103   - messages = Message.objects.filter(from_address__user__pk=user.pk)
104 106 context['list_activity'] = dict(messages.values_list(count_by)\
105 107 .annotate(Count(count_by))\
106 108 .order_by(count_by))
... ...