Skip to content

Commit

Permalink
fix page index starting from 0 (#4178)(patch)
Browse files Browse the repository at this point in the history
## Description
Adds adjustment to the offset of the sample querying taking into account that the page number received starts from 1 (not from 0)
  • Loading branch information
diitaz93 authored Feb 4, 2025
1 parent 35438ee commit 7042862
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cg/services/web_services/sample/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_samples(self, request: SamplesRequest, user: User) -> tuple[list[dict],
pattern=request.enquiry,
customers=customers,
limit=request.page_size,
offset=request.page,
offset=(request.page - 1) * request.page_size,
)
parsed_samples: list[dict] = [sample.to_dict() for sample in samples]
return parsed_samples, total
Expand Down

0 comments on commit 7042862

Please sign in to comment.