Commit 3d0b8c3fb33811332a2623ff81f155ca255e29f4
1 parent
bdb676c6
Exists in
master
and in
31 other branches
Fix cache not updating for different users and wrong email count
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
colab/search/utils.py
... | ... | @@ -41,13 +41,13 @@ def get_visible_threads(logged_user, filter_by_user=None): |
41 | 41 | |
42 | 42 | def get_collaboration_data(logged_user, filter_by_user=None): |
43 | 43 | latest_results = [] |
44 | - count_types = cache.get('home_chart') | |
44 | + count_types = cache.get('home_chart'+getattr(filter_by_user, "username", "")) | |
45 | 45 | populate_count_types = False |
46 | 46 | |
47 | 47 | if count_types is None: |
48 | 48 | populate_count_types = True |
49 | 49 | count_types = OrderedDict() |
50 | - visible_threads = get_visible_threads(logged_user) | |
50 | + visible_threads = get_visible_threads(logged_user, filter_by_user) | |
51 | 51 | count_types[_('Emails')] = len(visible_threads) |
52 | 52 | |
53 | 53 | messages = get_visible_threads(logged_user, filter_by_user) |
... | ... | @@ -89,6 +89,6 @@ def get_collaboration_data(logged_user, filter_by_user=None): |
89 | 89 | count_types[verbose_name] = elements_count |
90 | 90 | |
91 | 91 | if populate_count_types: |
92 | - cache.set('home_chart', count_types, 30) | |
92 | + cache.set('home_chart'+getattr(filter_by_user, "username", ""), count_types, 30) | |
93 | 93 | |
94 | 94 | return latest_results, count_types | ... | ... |