fix(fleet): compare customer identities without collation conflicts
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ public interface VehicleFulfillmentMapper {
|
||||
String DEPARTED = "EXISTS (SELECT 1 FROM ll_fleet_trip_history h WHERE h.trip_id=t.id AND h.action='DEPART' "
|
||||
+ "AND JSON_UNQUOTE(JSON_EXTRACT(h.snapshot_json,'$.trip.vehicleId'))=#{vehicleKey})";
|
||||
String DELIVERIES = " FROM ll_delivery_order d JOIN ll_fleet_trip_dispatch b "
|
||||
+ "ON b.dispatch_id=d.dispatch_order_id AND b.customer_id=d.customer_id "
|
||||
+ "ON b.dispatch_id=d.dispatch_order_id AND CAST(b.customer_id AS BINARY(128))=CAST(d.customer_id AS BINARY(128)) "
|
||||
+ "JOIN ll_fleet_trip t ON t.id=b.trip_id WHERE ((t.status='PLANNED' AND t.vehicle_id=#{vehicleId}) OR " + DEPARTED + ")";
|
||||
String PREVIOUS_VEHICLE = "JSON_UNQUOTE(JSON_EXTRACT(p.snapshot_json,'$.trip.vehicleId'))";
|
||||
String NEXT_VEHICLE = "JSON_UNQUOTE(JSON_EXTRACT(h.snapshot_json,'$.trip.vehicleId'))";
|
||||
|
||||
+2
@@ -59,6 +59,8 @@ public class VehicleFulfillmentQueryTest {
|
||||
}
|
||||
@Test void currentPlanUsesStableVehicleIdentityAndCustomerScopedDispatchJoin() {
|
||||
delivery(23,11,"WRONG-CUSTOMER");
|
||||
delivery(24,11,"CUSTOMER-A-OTHER");
|
||||
delivery(25,11,"customer-a");
|
||||
var result = service.deliveries(8,new VehicleFulfillmentModels.Query(1,10));
|
||||
assertThat(result.total()).isEqualTo(2);
|
||||
assertThat(result.records()).extracting(VehicleFulfillmentModels.Delivery::customerName).containsExactly("CUSTOMER-B","CUSTOMER-A");
|
||||
|
||||
Reference in New Issue
Block a user