X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/042f7939a264f7cdaa54df072ccd2c57e9587c4f..df1e1ca70a2c618eb376ea6b61207c726beac31d:/app/controllers/quickvote_controller.rb?ds=inline 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