* fix pagination for features/records (#1658) * remove given tests already existing
This commit is contained in:
+17
-11
@@ -531,17 +531,23 @@ def get_collection_items(
|
||||
'href': f'{uri}?offset={prev}{serialized_query_params}'
|
||||
})
|
||||
|
||||
if 'numberMatched' in content:
|
||||
if content['numberMatched'] > (limit + offset):
|
||||
next_ = offset + limit
|
||||
next_href = f'{uri}?offset={next_}{serialized_query_params}'
|
||||
content['links'].append(
|
||||
{
|
||||
'type': 'application/geo+json',
|
||||
'rel': 'next',
|
||||
'title': l10n.translate('Items (next)', request.locale),
|
||||
'href': next_href
|
||||
})
|
||||
next_link = False
|
||||
|
||||
if content.get('numberMatched', -1) > (limit + offset):
|
||||
next_link = True
|
||||
elif len(content['features']) == limit:
|
||||
next_link = True
|
||||
|
||||
if next_link:
|
||||
next_ = offset + limit
|
||||
next_href = f'{uri}?offset={next_}{serialized_query_params}'
|
||||
content['links'].append(
|
||||
{
|
||||
'type': 'application/geo+json',
|
||||
'rel': 'next',
|
||||
'title': l10n.translate('Items (next)', request.locale),
|
||||
'href': next_href
|
||||
})
|
||||
|
||||
content['links'].append(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user