Add unit tests
This commit is contained in:
parent
55598aaaa0
commit
5fe192d25a
9 changed files with 512 additions and 1037 deletions
|
|
@ -282,7 +282,9 @@ pub async fn get_hexagons(
|
|||
let t_total = t0.elapsed();
|
||||
info!(
|
||||
resolution,
|
||||
cells = groups.len(),
|
||||
cells_before_filter = groups.len(),
|
||||
cells_after_filter = features.len(),
|
||||
bounds = format_args!("{:.4},{:.4},{:.4},{:.4}", south, west, north, east),
|
||||
filters = num_filters,
|
||||
filters_raw = filters_str.as_deref().unwrap_or("-"),
|
||||
agg_ms = format_args!("{:.1}", t_agg.as_secs_f64() * 1000.0),
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ pub async fn get_postcodes(
|
|||
|
||||
// Build response, filtering postcodes to only those whose polygon intersects query bounds
|
||||
let mut features = Vec::with_capacity(postcode_aggs.len());
|
||||
let postcodes_before_filter = postcode_aggs.len();
|
||||
let mut filtered_out = 0usize;
|
||||
|
||||
for (pc_idx, aggregation) in postcode_aggs {
|
||||
if aggregation.count == 0 {
|
||||
|
|
@ -193,6 +195,7 @@ pub async fn get_postcodes(
|
|||
}
|
||||
|
||||
if !bounds_intersect(pc_south, pc_west, pc_north, pc_east, south, west, north, east) {
|
||||
filtered_out += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +238,10 @@ pub async fn get_postcodes(
|
|||
|
||||
let t_total = t0.elapsed();
|
||||
info!(
|
||||
postcodes = features.len(),
|
||||
postcodes_before_filter,
|
||||
postcodes_after_filter = features.len(),
|
||||
filtered_out,
|
||||
bounds = format_args!("{:.6},{:.6},{:.6},{:.6}", south, west, north, east),
|
||||
filters = num_filters,
|
||||
filters_raw = filters_str.as_deref().unwrap_or("-"),
|
||||
total_ms = format_args!("{:.1}", t_total.as_secs_f64() * 1000.0),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue