Skip to content

Commit c09f13b

Browse files
authoredJul 11, 2016
Merge pull request ideal-postcodes#71 from cblanc/master
Order by postcode if distances are equal
2 parents 9c9df61 + 36f4569 commit c09f13b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎app/models/postcode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ var nearestPostcodeQuery = ["SELECT postcodes.*,",
281281
"FROM postcodes",
282282
toJoinString(),
283283
"WHERE ST_DWithin(location, ST_GeographyFromText('POINT(' || $1 || ' ' || $2 || ')'), $3)",
284-
"ORDER BY distance",
284+
"ORDER BY distance ASC, postcode ASC",
285285
"LIMIT $4"].join(" ");
286286

287287
Postcode.prototype.nearestPostcodes = function (params, callback) {

0 commit comments

Comments
 (0)
Please sign in to comment.