refactor: use db independent offset syntax (#31345)

* chore: use db independent offset syntax

* fix: typo

* style: reformat code to black spec

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
Conor
2022-06-14 00:19:07 -05:00
committed by GitHub
parent 39338e70d5
commit 00ef499739
19 changed files with 40 additions and 37 deletions

View File

@@ -391,7 +391,7 @@ def get_users_for_project(doctype, txt, searchfield, start, page_len, filters):
if(locate(%(_txt)s, full_name), locate(%(_txt)s, full_name), 99999),
idx desc,
name, full_name
limit %(start)s, %(page_len)s""".format(
limit %(page_len)s offset %(start)s""".format(
**{
"key": searchfield,
"fcond": get_filters_cond(doctype, filters, conditions),

View File

@@ -288,7 +288,7 @@ def get_project(doctype, txt, searchfield, start, page_len, filters):
%(mcond)s
{search_condition}
order by name
limit %(start)s, %(page_len)s""".format(
limit %(page_len)s offset %(start)s""".format(
search_columns=search_columns, search_condition=search_cond
),
{

View File

@@ -328,7 +328,7 @@ def get_timesheet(doctype, txt, searchfield, start, page_len, filters):
ts.status in ('Submitted', 'Payslip') and tsd.parent = ts.name and
tsd.docstatus = 1 and ts.total_billable_amount > 0
and tsd.parent LIKE %(txt)s {condition}
order by tsd.parent limit %(start)s, %(page_len)s""".format(
order by tsd.parent limit %(page_len)s offset %(start)s""".format(
condition=condition
),
{
@@ -515,7 +515,7 @@ def get_timesheets_list(
tsd.project IN %(projects)s
)
ORDER BY `end_date` ASC
LIMIT {0}, {1}
LIMIT {1} offset {0}
""".format(
limit_start, limit_page_length
),