Skip to content

Commit

Permalink
Ensure District councils are detected first over City councils, and t…
Browse files Browse the repository at this point in the history
…hat an unknown council doesn't kill the client.
  • Loading branch information
craigw committed Oct 7, 2012
1 parent 9a3244b commit 4677fae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/my_society/map_it.rb
Expand Up @@ -23,11 +23,15 @@ module LocalAuthorityFinder
).map { |c| c.freeze }.freeze

def local_authority
local_authority_info = to_point.to_hash.values.detect do |la|
local_authority_info = to_point.to_hash.values.sort_by { |a|
LOCAL_AUTHORITY_TYPE_CODES.index(a['type']) || -1
}.detect do |la|
LOCAL_AUTHORITY_TYPE_CODES.include? la['type']
end

LocalAuthority.new local_authority_info
rescue
nil
end
end

Expand Down

0 comments on commit 4677fae

Please sign in to comment.