From 11e84034ad28147e9aec78fd895b03b2652b81bf Mon Sep 17 00:00:00 2001 From: Gustavo Jaruga Cruz Date: Thu, 17 Mar 2016 11:11:43 -0300 Subject: [PATCH 1/2] Fix collaboration graph count Signed-off-by: Gustavo Jaruga Cruz --- colab/plugins/utils/collaborations.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/colab/plugins/utils/collaborations.py b/colab/plugins/utils/collaborations.py index 7d40af79..ed9c5cff 100644 --- a/colab/plugins/utils/collaborations.py +++ b/colab/plugins/utils/collaborations.py @@ -8,8 +8,7 @@ from django.conf import settings from colab.plugins.utils.models import Collaboration -from colab.super_archives.utils.collaborations import (get_visible_threads, - count_threads) +from colab.super_archives.utils.collaborations import (get_visible_threads) def get_collaboration_data(logged_user, filter_by_user=None): @@ -20,13 +19,13 @@ def get_collaboration_data(logged_user, filter_by_user=None): latest_results = [] populate_count_types = False + messages = get_visible_threads(logged_user, filter_by_user) + if count_types is None: populate_count_types = True count_types = OrderedDict() - count_types[_('Emails')] = count_threads() - - messages = get_visible_threads(logged_user, filter_by_user) + count_types[_('Emails')] = len(messages) latest_results.extend(messages) From aee40e03c8238550142a576130469ce9f93a21b2 Mon Sep 17 00:00:00 2001 From: Matheus Faria Date: Wed, 23 Mar 2016 15:24:19 -0300 Subject: [PATCH 2/2] Adding super_archives counting threads test --- .../tests/test_utils_collaborations.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 colab/super_archives/tests/test_utils_collaborations.py diff --git a/colab/super_archives/tests/test_utils_collaborations.py b/colab/super_archives/tests/test_utils_collaborations.py new file mode 100644 index 00000000..f5d394db --- /dev/null +++ b/colab/super_archives/tests/test_utils_collaborations.py @@ -0,0 +1,12 @@ +# -*- coding:utf-8 -*- + +from django.test import TestCase +from colab.super_archives.utils.collaborations import count_threads + + +class CollaborationTest(TestCase): + + fixtures = ['mailinglistdata.json'] + + def test_count_threads(self): + self.assertEquals(count_threads(), 5)