Skip to content

Commit

Permalink
Also limit non-detailed to 20
Browse files Browse the repository at this point in the history
  • Loading branch information
xarantolus committed Nov 19, 2023
1 parent 3dbaff2 commit 0a6b254
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ async fn craftsmen_search(
let map = data.read().unwrap();

Ok(HttpResponse::Ok().content_type("application/json").body(
if let Some(service_providers) = map.ranked_by_score(postalcode.parse().unwrap()) {
if let Some(mut service_providers) = map.ranked_by_score(postalcode.parse().unwrap()) {
service_providers.truncate(20);
serde_json::to_string(&service_providers).unwrap()
} else {
"[]".to_string()
Expand Down

0 comments on commit 0a6b254

Please sign in to comment.