Skip to content

Commit

Permalink
Implement fix for geolocation regression
Browse files Browse the repository at this point in the history
  • Loading branch information
cblanc committed Jun 18, 2018
1 parent d1f1ba2 commit 087b0e4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
16 changes: 14 additions & 2 deletions app/models/postcode.js
Expand Up @@ -642,8 +642,20 @@ Postcode.prototype.seedPostcodes = function (filepath, callback) {
{ column: "pc_compact", method: row => row.extract("pcds").replace(/\s/g, "") },
{ column: "eastings", method: row => row.extract("oseast1m") },
{ column: "northings", method: row => row.extract("osnrth1m") },
{ column: "longitude", method: row => row.extract("long") },
{ column: "latitude", method: row => row.extract("lat") },
{
column: "longitude",
method: row => {
const longitude = row.extract("long");
return (parseInt(longitude, 10) === 0) ? null : longitude;
},
},
{
column: "latitude",
method: row => {
const latitude = row.extract("lat");
return (parseInt(latitude, 10) > 98) ? null : latitude;
},
},
{ column: "country", method: row => countries[row.extract("ctry")] },
{ column: "nhs_ha", method: row => nhsHa[row.extract("oshlthau")] },
{ column: "admin_county_id", method: row => row.extract("oscty") },
Expand Down
16 changes: 14 additions & 2 deletions app/models/terminated_postcode.js
Expand Up @@ -72,8 +72,20 @@ TerminatedPostcode.prototype.seedPostcodes = function (filepath, callback) {
{ column: "month_terminated", method: row => row.extract("doterm").slice(-2) },
{ column: "eastings", method: row => row.extract("oseast1m") },
{ column: "northings", method: row => row.extract("osnrth1m") },
{ column: "longitude", method: row => row.extract("long") },
{ column: "latitude", method: row => row.extract("lat") },
{
column: "longitude",
method: row => {
const longitude = row.extract("long");
return (parseInt(longitude, 10) === 0) ? null : longitude;
},
},
{
column: "latitude",
method: row => {
const latitude = row.extract("lat");
return (parseInt(latitude, 10) > 98) ? null : latitude;
},
}
]);

this._csvSeed({
Expand Down

0 comments on commit 087b0e4

Please sign in to comment.