Commit 5b6579aa authored by Julien Muchembled's avatar Julien Muchembled

searchAndActivate: sorting results was useless when activity_count=None

parent 9321cec0
Pipeline #32288 failed with stage
in 0 seconds
...@@ -1376,14 +1376,18 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -1376,14 +1376,18 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
group_method_cost = group_kw.get('group_method_cost', .034) # 30 objects group_method_cost = group_kw.get('group_method_cost', .034) # 30 objects
if limit == 0: if limit == 0:
limit = 100 * int(ceil(1 / group_method_cost)) limit = 100 * int(ceil(1 / group_method_cost))
if min_uid:
catalog_kw['min_uid'] = SimpleQuery(uid=min_uid,
comparison_operator='>')
if catalog_kw.pop('restricted', False): if catalog_kw.pop('restricted', False):
search = self search = self
else: else:
search = self.unrestrictedSearchResults search = self.unrestrictedSearchResults
r = search(sort_on=(('uid','ascending'),), limit=limit, **catalog_kw) if limit is None:
r = search(**catalog_kw)
else:
if min_uid:
catalog_kw['min_uid'] = SimpleQuery(uid=min_uid,
comparison_operator='>')
r = search(sort_on=(('uid','ascending'),), limit=limit, **catalog_kw)
result_count = len(r) result_count = len(r)
if result_count: if result_count:
if result_count == limit: if result_count == limit:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment