X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/bf220bde847fd30e9bf0d00dd7c9aff31265c810..9516096632eaa0015fa67613aaa0bed711481a72:/app/controllers/quickvote_controller.rb diff --git a/app/controllers/quickvote_controller.rb b/app/controllers/quickvote_controller.rb index d8d3d59..cc57bb5 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 @@ -178,8 +185,7 @@ class QuickvoteController < ApplicationController marker = GMarker.new([location.lat,location.lng], :title => "Voter", - :info_window => (voter.ipaddress or "unknown") \ - + " " + voter.vote.votestring) + :info_window => (voter.ipaddress or "unknown")) @map.overlay_init(marker) end end