Skip to content

Commit

Permalink
Merge branch 'master' into sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
markfee committed Nov 9, 2023
2 parents 92a42af + 145136a commit 2b0f055
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 13 additions & 0 deletions server/services/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 []
}
Expand Down
6 changes: 2 additions & 4 deletions server/views/confirm-location.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
<div id="confirm-location-page" class="govuk-grid-row">

<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">
Draw the boundary of your site
</h1>
<h1 class="govuk-heading-xl">Draw the boundary of your site</h1>
</div>

<div class="govuk-grid-column-two-thirds">
<div class="hide" data-journey="{{analyticsPageEvent}}"></div>
{% if locationDetails %}
<p class="govuk-body">Your search for '{{placeOrPostcodeUnencoded}}' has been placed in {{locationDetails}}.</p>
<p class="govuk-body your-search-details">Your search for '{{placeOrPostcodeUnencoded}}' has been placed in {{locationDetails}}.</p>
{% endif %}
{% if polygonMissing %}
{{ govukErrorSummary({
Expand Down

0 comments on commit 2b0f055

Please sign in to comment.