Fixed front page on mobile and improved city lookup
This commit is contained in:
@@ -24,15 +24,25 @@ end
|
||||
|
||||
task update_cities: :environment do
|
||||
Location.all.each do |l|
|
||||
city = City.search(([l.city, l.territory, l.country] - [nil, '']).join(', '))
|
||||
l.city_id = city.id
|
||||
l.save!
|
||||
s = ([l.city, l.territory, l.country] - [nil, '']).join(', ')
|
||||
unless l.city_id.present?
|
||||
begin
|
||||
puts "Searching for #{s}"
|
||||
city = City.search(s)
|
||||
l.city_id = city.id
|
||||
l.save!
|
||||
rescue
|
||||
puts "Error searching for #{s}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
City.all.each do |c|
|
||||
location = Geocoder.search(c.address, language: 'en').first
|
||||
c.place_id = location.data['place_id']
|
||||
c.save!
|
||||
unless c.place_id.present?
|
||||
City.all.each do |c|
|
||||
location = Geocoder.search(c.address, language: 'en').first
|
||||
c.place_id = location.data['place_id']
|
||||
c.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,3 +53,11 @@ task update_cities_es: :environment do
|
||||
c.save!
|
||||
end
|
||||
end
|
||||
|
||||
task update_cities_fr: :environment do
|
||||
City.all.each do |c|
|
||||
city = c.get_translation(:fr)
|
||||
c.set_column_for_locale(:city, :fr, city, 0) unless city.blank? || city == c.get_column_for_locale(:city, :fr)
|
||||
c.save!
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user