diff --git a/custom_ui/api/db/estimates.py b/custom_ui/api/db/estimates.py index 5570f90..27bd1a3 100644 --- a/custom_ui/api/db/estimates.py +++ b/custom_ui/api/db/estimates.py @@ -30,7 +30,7 @@ def get_estimate_table_data(filters={}, sortings=[], page=1, page_size=10): filters=processed_filters if not is_or else None, or_filters=processed_filters if is_or else None, limit=page_size, - start=page * page_size, + start=(page - 1) * page_size, order_by=processed_sortings ) diff --git a/custom_ui/api/db/jobs.py b/custom_ui/api/db/jobs.py index e47658c..3f78a3d 100644 --- a/custom_ui/api/db/jobs.py +++ b/custom_ui/api/db/jobs.py @@ -118,7 +118,7 @@ def get_jobs_table_data(filters={}, sortings=[], page=1, page_size=10): filters=processed_filters if not is_or else None, or_filters=processed_filters if is_or else None, limit=page_size, - start=page * page_size, + start=(page - 1) * page_size, order_by=processed_sortings ) diff --git a/frontend/src/api.js b/frontend/src/api.js index b110b4a..516c2c8 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -204,9 +204,9 @@ class Api { for_table: true, }; - console.log("DEBUG: API - Sending estimate options to backend:", page, pageSize, filters, sorting); + console.log("DEBUG: API - Sending estimate options to backend:", options); - const result = await this.request(FRAPPE_GET_ESTIMATES_METHOD, { page, pageSize, filters, sorting}); + const result = await this.request(FRAPPE_GET_ESTIMATES_METHOD, { options }); return result; } @@ -285,9 +285,9 @@ class Api { for_table: true, }; - console.log("DEBUG: API - Sending job options to backend:", page, pageSize, filters, sorting); + console.log("DEBUG: API - Sending job options to backend:", options); - const result = await this.request(FRAPPE_GET_JOBS_METHOD, { page, pageSize, filters, sorting}); + const result = await this.request(FRAPPE_GET_JOBS_METHOD, { options }); return result; }