0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-21 13:38:21 -05:00

♻️ refactor: start tracking page numbers from 0 instead of 1 in the backend (#467)

Co-authored-by: neon_arch <mustafadhuleb53@gmail.com>
This commit is contained in:
ddotthomas 2023-12-29 11:20:38 -07:00 committed by GitHub
parent 9f23a1c70b
commit d073aa247a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,11 +59,11 @@ pub async fn search(
)
};
// .max(1) makes sure that the page > 0.
let page = params.page.unwrap_or(1).max(1);
// .max(1) makes sure that the page >= 0.
let page = params.page.unwrap_or(1).max(1) - 1;
let (_, results, _) = join!(
get_results(page - 1),
get_results(page.saturating_sub(1)),
get_results(page),
get_results(page + 1)
);