Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Fix for order/limit/pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
emi420 committed Jun 5, 2024
1 parent 149c783 commit 224fc2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/dbapi/api/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def listFeaturesQuery(
order=params.orderBy.value,
limit=RESULTS_PER_PAGE_LIST,
offset=params.page * RESULTS_PER_PAGE_LIST
) if params.page else ""
) if params.page is not None else " LIMIT {limit} OFFSET {offset}"
).replace("WHERE AND", "WHERE")
if asJson:
return listQueryToJSON(query, params)
Expand Down
4 changes: 2 additions & 2 deletions python/dbapi/api/rawValidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ def listFeaturesQuery(
) if params.area else "",
tags=" AND (" + tagsQueryFilter(params.tags, table.value) + ")" if params.tags else "",
status=" AND status = '{status}'".format(status=params.status.value) if (params.status) else "",
order=" ORDER BY {order} DESC LIMIT {limit} OFFSET {offset}"
order=" AND {order} IS NOT NULL ORDER BY {order} DESC LIMIT {limit} OFFSET {offset}"
.format(
order=orderBy.value,
limit=RESULTS_PER_PAGE_LIST,
offset=params.page * RESULTS_PER_PAGE_LIST
)
) if params.page is not None else " LIMIT {limit} OFFSET {offset}"
).replace("WHERE AND", "WHERE")
if asJson:
return listQueryToJSON(query, params)
Expand Down

0 comments on commit 224fc2a

Please sign in to comment.