diff --git a/package-lock.json b/package-lock.json index 6ce4bbc0..20e8b99d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fmfp", - "version": "2.7.0-pre.2", + "version": "2.7.0-pre.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fmfp", - "version": "2.7.0-pre.2", + "version": "2.7.0-pre.3", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 83902f47..a829106f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fmfp", - "version": "2.7.0-pre.2", + "version": "2.7.0-pre.3", "dataVersion": "2.5.1", "description": "Flood map for planning", "main": "index.js", diff --git a/server/services/address.js b/server/services/address.js index b3451b00..8365ad39 100644 --- a/server/services/address.js +++ b/server/services/address.js @@ -3,11 +3,24 @@ const config = require('../../config') const { osNamesUrl, osSearchKey } = config.ordnanceSurvey const fqFilter = 'LOCAL_TYPE:City%20LOCAL_TYPE:Hamlet%20LOCAL_TYPE:Other_Settlement%20LOCAL_TYPE:Suburban_Area%20LOCAL_TYPE:Town%20LOCAL_TYPE:PostCode%20LOCAL_TYPE:Village' +// FCRM-4460 was to fix searches for large towns and cities with Proper Names that differ from their common names. +// The first attempt was to try and make a match on the data returned from OS Names, but this only worked for Brighton, +// as it is a place in it's own right (although the OS Place Names returns a village in Cornwall as the top result). +// This is a less than ideal workaround, that hard codes specific results, if any more are found they need to be added to this list. +const shortNames = { + Brighton: 'Brighton and Hove', + Newcastle: 'Newcastle upon Tyne', + Stockton: 'Stockton-on-Tees' +} + +const replaceCommonSearchTerms = place => shortNames[place] || place + module.exports = { findByPlace: async (place) => { const uri = `${osNamesUrl}${place}&key=${osSearchKey}&fq=${fqFilter}`.replace('maxresults=1&', 'maxresults=10&') const payload = await util.getJson(uri) + place = replaceCommonSearchTerms(place) // FCRM-4460 - see comment above if (!payload || !payload.results || !payload.results.length) { return [] } diff --git a/server/views/confirm-location.html b/server/views/confirm-location.html index 77ef75f6..112c3f45 100644 --- a/server/views/confirm-location.html +++ b/server/views/confirm-location.html @@ -25,7 +25,7 @@
Your search for '{{placeOrPostcodeUnencoded}}' has been placed in {{locationDetails}}.
+Your search for '{{placeOrPostcodeUnencoded}}' has been placed in {{locationDetails}}.
{% endif %} {% if polygonMissing %} {{ govukErrorSummary({