From 582382dc5c36dce98f30dcdcb55016227f9a1f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gw=C3=A9na=C3=ABl=20Rault?= Date: Wed, 3 Dec 2025 09:23:28 +0100 Subject: [PATCH 1/2] Fix zip_cluster with quantities using pickup and delivery --- core/services/clustering_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/services/clustering_service.rb b/core/services/clustering_service.rb index 4b716b57..9f7a5708 100644 --- a/core/services/clustering_service.rb +++ b/core/services/clustering_service.rb @@ -47,7 +47,7 @@ def zip_cluster(vrp, cluster_threshold) matrix = vrp.matrices[0][vrp.vehicles[0].router_dimension.to_sym] used_units = {} - vrp.services.each{ |s| s.quantities.each{ |q| used_units[q.unit.id] = true if q.value != 0 } } + vrp.services.each{ |s| s.quantities.each{ |q| used_units[q.unit.id] = true if q.pickup != 0 || q.delivery != 0 } } no_useful_capacities = vrp.vehicles.none?{ |v| v.capacities.any?{ |capa| capa.limit && used_units.key?(capa.unit.id) } From 76825c9caf80f3de78ada1aa626d0e572b95d0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gw=C3=A9na=C3=ABl=20Rault?= Date: Wed, 3 Dec 2025 09:33:43 +0100 Subject: [PATCH 2/2] Fix lint --- lib/output_helper.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/output_helper.rb b/lib/output_helper.rb index 4f2129a2..aabeef41 100644 --- a/lib/output_helper.rb +++ b/lib/output_helper.rb @@ -444,9 +444,13 @@ def collect_basic_hulls(elements, entity, cluster_index, cluster_name, skills_pr end def generate_points_geometry(result, vehicle_color_indices) - return nil unless (result[:unassigned].empty? || result[:unassigned].any?{ |un| un[:detail][:lat] && un[:detail][:lon] }) && - (result[:routes].all?{ |r| r[:activities].empty? } || - result[:routes].any?{ |r| r[:activities].any?{ |a| a[:detail] && a[:detail][:lat] && a[:detail][:lon] } }) + unassigned_has_coords = + result[:unassigned].empty? || + result[:unassigned].any?{ |un| un[:detail][:lat] && un[:detail][:lon] } + routes_have_coords = + result[:routes].all?{ |r| r[:activities].empty? } || + result[:routes].any?{ |r| r[:activities].any?{ |a| a[:detail] && a[:detail][:lat] && a[:detail][:lon] } } + return nil unless unassigned_has_coords && routes_have_coords points = []