From bc3439298074e8139f9d8af8438a224616cf681a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 31 Jul 2023 09:01:15 +0300 Subject: Fix bugs. Return resource without data items. * Fix bugs introduced while attempting pagination. * Return resource object without attached data items. --- gn3/auth/authorisation/resources/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gn3/auth/authorisation/resources/views.py') diff --git a/gn3/auth/authorisation/resources/views.py b/gn3/auth/authorisation/resources/views.py index 2e6c244..c39d4ab 100644 --- a/gn3/auth/authorisation/resources/views.py +++ b/gn3/auth/authorisation/resources/views.py @@ -96,13 +96,13 @@ def view_resource_data(resource_id: uuid.UUID) -> Response: with require_oauth.acquire("profile group resource") as the_token: db_uri = app.config["AUTH_DB"] count_per_page = __safe_get_requests_count__("count_per_page") - page = (__safe_get_requests_page__("page") - 1) + offset = (__safe_get_requests_page__("page") - 1) with db.connection(db_uri) as conn: resource = resource_by_id(conn, the_token.user, resource_id) return jsonify(resource_data( conn, resource, - ((page * count_per_page) if bool(count_per_page) else page), + ((offset * count_per_page) if bool(count_per_page) else offset), count_per_page)) @resources.route("/data/link", methods=["POST"]) -- cgit v1.2.3