Skip to content

Commit

Permalink
Merge a2391d2 into 5d4cc7b
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Jun 5, 2019
2 parents 5d4cc7b + a2391d2 commit a98b29f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/collective/collectionfilter/baseviews.py
Expand Up @@ -97,6 +97,7 @@ def results(self):
group_by=self.settings.group_by,
filter_type=self.settings.filter_type,
narrow_down=self.settings.narrow_down,
show_count=self.settings.show_count,
view_name=self.settings.view_name,
cache_enabled=self.settings.cache_enabled,
request_params=self.top_request.form or {}
Expand Down
7 changes: 5 additions & 2 deletions src/collective/collectionfilter/filteritems.py
Expand Up @@ -37,6 +37,7 @@ def _results_cachekey(
group_by,
filter_type=DEFAULT_FILTER_TYPE,
narrow_down=False,
show_count=False,
view_name='',
cache_enabled=True,
request_params=None):
Expand All @@ -47,6 +48,7 @@ def _results_cachekey(
group_by,
filter_type,
narrow_down,
show_count,
view_name,
request_params,
' '.join(plone.api.user.get_roles()),
Expand All @@ -62,6 +64,7 @@ def get_filter_items(
group_by,
filter_type=DEFAULT_FILTER_TYPE,
narrow_down=False,
show_count=False,
view_name='',
cache_enabled=True,
request_params=None
Expand Down Expand Up @@ -110,7 +113,7 @@ def get_filter_items(
brains=True,
custom_query=custom_query
)
if narrow_down:
if narrow_down and show_count:
# we need the extra_ignores to get a true count
# even when narrow_down filters the display of indexed values
# count_query allows us to do that true count
Expand Down Expand Up @@ -208,7 +211,7 @@ def get_filter_items(
urlquery_all = {
k: v for k, v in list(urlquery.items()) if k not in (idx, idx + '_op')
}
if narrow_down:
if narrow_down and show_count:
catalog_results = catalog_results_fullcount
ret = [{
'title': translate(
Expand Down
2 changes: 2 additions & 0 deletions src/collective/collectionfilter/tests/test_filteritems.py
Expand Up @@ -57,6 +57,7 @@ def test_filteritems(self):
self.collection_uid, 'Subject',
request_params={'Subject': u'Dokumänt'},
narrow_down=True,
show_count=True,
cache_enabled=False)

self.assertEqual(
Expand Down Expand Up @@ -94,6 +95,7 @@ def test_portal_type_filter(self):
self.collection_uid, 'portal_type',
request_params={'portal_type': u'Event'},
narrow_down=True,
show_count=True,
cache_enabled=False)

self.assertEqual(len(result), 2)
Expand Down

0 comments on commit a98b29f

Please sign in to comment.