Fix relationship for looking up whether the pool is in the district

This commit is contained in:
Eli Ribble 2026-04-15 19:31:32 +00:00
parent b08582224a
commit 87c802fa90
No known key found for this signature in database

View file

@ -113,10 +113,14 @@ func bulkGeocode(ctx context.Context, txn bob.Tx, file *models.FileuploadFile, c
SET is_in_district = (
EXISTS (
SELECT 1
FROM import.district d
JOIN organization o ON d.gid = o.import_district_gid
WHERE o.id = p.organization_id
AND ST_Contains(d.geom_4326, p.geom)
FROM organization o, fileupload.file f
WHERE
p.csv_file = f.id AND
f.organization_id = o.id AND (
ST_Contains(o.service_area_geometry, p.geom) OR
o.is_catchall
)
)
)
WHERE p.geom IS NOT NULL;`