X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/9eabcf350184159475e1c88e9cd603a22e2bb465..f38aa87edf153cf8f5f5c93a78fbf1424a8e62f2:/app/controllers/quickvote_controller.rb diff --git a/app/controllers/quickvote_controller.rb b/app/controllers/quickvote_controller.rb index d8d3d59..b9c790f 100644 --- a/app/controllers/quickvote_controller.rb +++ b/app/controllers/quickvote_controller.rb @@ -168,7 +168,14 @@ class QuickvoteController < ApplicationController @election=QuickVote.ident_to_quickvote(params[:id]) @election.voters.each do |voter| next unless voter.ipaddress - location = GeoKit::Geocoders::IpGeocoder.geocode(voter.ipaddress) + location=nil + if Cache and location=Cache.get("GEO:#{voter.ipaddress}") + elsif Cache + location = GeoKit::Geocoders::IpGeocoder.geocode(voter.ipaddress) + Cache.set "GEO:#{voter.ipaddress}", location + else + location = GeoKit::Geocoders::IpGeocoder.geocode(voter.ipaddress) + end next unless location.lng and location.lat unless center