Split bot and service

This commit is contained in:
Benjamin Sherriff
2023-10-04 19:05:24 -04:00
parent 06f8af6051
commit cee9dbdc81
24 changed files with 1144 additions and 246 deletions

View File

@@ -74,7 +74,7 @@ async fn get_all(req: HttpRequest) -> HttpResponse {
// Limit must be between 1 and 100
let limit = std::cmp::min(std::cmp::max(params.limit.unwrap_or(20), 1), 100);
let total_count = QuerySpell::get_count(&filters).unwrap();
let max_page = std::cmp::max(1, (total_count as f64 / limit as f64).ceil() as i32);
let max_page = std::cmp::max((total_count as f64 / limit as f64).ceil() as i32, 1);
// Page must be between 1 and max_page
let page = std::cmp::min(std::cmp::max(params.page.unwrap_or(1), 1), max_page);