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

Commit 224fc2a

Browse files
committed
Fix for order/limit/pagination
1 parent 149c783 commit 224fc2a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

python/dbapi/api/raw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def listFeaturesQuery(
137137
order=params.orderBy.value,
138138
limit=RESULTS_PER_PAGE_LIST,
139139
offset=params.page * RESULTS_PER_PAGE_LIST
140-
) if params.page else ""
140+
) if params.page is not None else " LIMIT {limit} OFFSET {offset}"
141141
).replace("WHERE AND", "WHERE")
142142
if asJson:
143143
return listQueryToJSON(query, params)

python/dbapi/api/rawValidation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ def listFeaturesQuery(
179179
) if params.area else "",
180180
tags=" AND (" + tagsQueryFilter(params.tags, table.value) + ")" if params.tags else "",
181181
status=" AND status = '{status}'".format(status=params.status.value) if (params.status) else "",
182-
order=" ORDER BY {order} DESC LIMIT {limit} OFFSET {offset}"
182+
order=" AND {order} IS NOT NULL ORDER BY {order} DESC LIMIT {limit} OFFSET {offset}"
183183
.format(
184184
order=orderBy.value,
185185
limit=RESULTS_PER_PAGE_LIST,
186186
offset=params.page * RESULTS_PER_PAGE_LIST
187-
)
187+
) if params.page is not None else " LIMIT {limit} OFFSET {offset}"
188188
).replace("WHERE AND", "WHERE")
189189
if asJson:
190190
return listQueryToJSON(query, params)

0 commit comments

Comments
 (0)