mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[Collate Address] when updating address point, do not use the point's address reference if the similarity is below
This commit is contained in:
parent
4d7b4500c1
commit
98c2ee3ab2
7
.changes/unreleased/Fixed-20230715-085153.yaml
Normal file
7
.changes/unreleased/Fixed-20230715-085153.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: '[Collate Address] when updating address point, do not use the point''s address
|
||||||
|
reference if the similarity is below the requirement for associating the address
|
||||||
|
reference and the address (it uses the postcode''s center instead)'
|
||||||
|
time: 2023-07-15T08:51:53.293736534+02:00
|
||||||
|
custom:
|
||||||
|
Issue: ""
|
@ -76,11 +76,17 @@ final readonly class CollateAddressWithReferenceOrPostalCode implements CollateA
|
|||||||
UPDATE chill_main_address SET addressreference_id = recollate.address_reference_id FROM recollate WHERE chill_main_address.id = recollate.address_id;
|
UPDATE chill_main_address SET addressreference_id = recollate.address_reference_id FROM recollate WHERE chill_main_address.id = recollate.address_id;
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the point's address with the:
|
||||||
|
*
|
||||||
|
* - address reference point, if the address match the reference with sufficient similarity
|
||||||
|
* - or the postcal code center
|
||||||
|
*/
|
||||||
private const UPDATE_POINT = <<<'SQL'
|
private const UPDATE_POINT = <<<'SQL'
|
||||||
WITH address_geom AS (
|
WITH address_geom AS (
|
||||||
SELECT cma.id AS address_id, COALESCE(cmar.point, cmpc.center) AS point
|
SELECT cma.id AS address_id, COALESCE(cmar.point, cmpc.center) AS point
|
||||||
FROM chill_main_address cma
|
FROM chill_main_address cma
|
||||||
LEFT JOIN chill_main_address_reference cmar ON cma.addressreference_id = cmar.id
|
LEFT JOIN chill_main_address_reference cmar ON cma.addressreference_id = cmar.id AND similarity(cma.street, cmar.street) > 0.6 AND LOWER(cma.streetnumber) = LOWER(cmar.streetnumber)
|
||||||
LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id
|
LEFT JOIN chill_main_postal_code cmpc ON cma.postcode_id = cmpc.id
|
||||||
WHERE cma.id > :since_id
|
WHERE cma.id > :since_id
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user