Commit 9975ff625e95fe18f9703d0c15913feba5b3ee35
1 parent
fa6c79ff
Exists in
master
and in
13 other branches
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,6 +71,7 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): | ||
| 71 | 'ticket': TicketCollabCount, | 71 | 'ticket': TicketCollabCount, |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | + messages = Message.objects.filter(from_address__user__pk=user.pk) | ||
| 74 | for type in ['thread', 'ticket', 'wiki', 'changeset', 'attachment']: | 75 | for type in ['thread', 'ticket', 'wiki', 'changeset', 'attachment']: |
| 75 | CounterClass = counter_class.get(type) | 76 | CounterClass = counter_class.get(type) |
| 76 | if CounterClass: | 77 | if CounterClass: |
| @@ -80,6 +81,8 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): | @@ -80,6 +81,8 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): | ||
| 80 | count_types[trans(type)] = 0 | 81 | count_types[trans(type)] = 0 |
| 81 | else: | 82 | else: |
| 82 | count_types[trans(type)] = counter.count | 83 | count_types[trans(type)] = counter.count |
| 84 | + elif type == 'thread': | ||
| 85 | + count_types[trans(type)] = messages.count() | ||
| 83 | else: | 86 | else: |
| 84 | sqs = SearchQuerySet() | 87 | sqs = SearchQuerySet() |
| 85 | for filter_or in fields_or_lookup: | 88 | for filter_or in fields_or_lookup: |
| @@ -100,7 +103,6 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): | @@ -100,7 +103,6 @@ class UserProfileDetailView(UserProfileBaseMixin, DetailView): | ||
| 100 | context['emails'] = query[:10] | 103 | context['emails'] = query[:10] |
| 101 | 104 | ||
| 102 | count_by = 'thread__mailinglist__name' | 105 | count_by = 'thread__mailinglist__name' |
| 103 | - messages = Message.objects.filter(from_address__user__pk=user.pk) | ||
| 104 | context['list_activity'] = dict(messages.values_list(count_by)\ | 106 | context['list_activity'] = dict(messages.values_list(count_by)\ |
| 105 | .annotate(Count(count_by))\ | 107 | .annotate(Count(count_by))\ |
| 106 | .order_by(count_by)) | 108 | .order_by(count_by)) |