Commit f61c7750102804994d7eb77b863f9e2d486ea123

Authored by Aurelio A. Heckert
Committed by Joenio Costa
1 parent 59b729e5

Add localization in sample-data to help map devs

(ActionItem1577)
Showing 1 changed file with 34 additions and 0 deletions   Show diff stats
script/sample-data
... ... @@ -11,6 +11,35 @@ else
11 11 environment = Environment.default
12 12 end
13 13  
  14 +places = [
  15 + { :country=>'BR', :city=>'Salvador',
  16 + :lat=>-12.94032, :lng=>-38.58398 },
  17 + { :country=>'BR', :city=>'São Paulo',
  18 + :lat=>-23.54894, :lng=>-46.63881 },
  19 + { :country=>'BR', :city=>'Rio de Janeiro',
  20 + :lat=>-22.90353, :lng=>-43.20958 },
  21 + { :country=>'AR', :city=>'Buenos Aires',
  22 + :lat=>-34.61088, :lng=>-58.39782 },
  23 + { :country=>'AR', :city=>'Mar del Plata',
  24 + :lat=>-37.98317, :lng=>-57.59513 },
  25 + { :country=>'MX', :city=>'Acapulco',
  26 + :lat=>16.86369, :lng=>-99.88151 },
  27 + { :country=>'US', :city=>'Los Angeles',
  28 + :lat=>34.02307, :lng=>-118.24310 },
  29 + { :country=>'IT', :city=>'Roma',
  30 + :lat=>41.89512, :lng=>12.48184 },
  31 + { :country=>'IN', :city=>'Mumbai',
  32 + :lat=>19.01798, :lng=>72.85583 },
  33 + { :country=>'CN', :city=>'Shanghai',
  34 + :lat=>31.23041, :lng=>121.47308 },
  35 + { :country=>'JP', :city=>'Tokyo',
  36 + :lat=>35.68964, :lng=>139.69116 },
  37 + { :country=>'FR', :city=>'Paris',
  38 + :lat=>48.85658, :lng=>2.351074 },
  39 + { :country=>'BW', :city=>'Sowa',
  40 + :lat=>-20.56891, :lng=>26.22367 }
  41 +]
  42 +
14 43 people = []
15 44  
16 45 NAMES = %w[ José João Antonio Paulo Maria Joana Paula Angela ]
... ... @@ -27,6 +56,11 @@ for name in NAMES
27 56 :environment => environment,
28 57 })
29 58 user.person.name = full_name
  59 + place = places[rand(places.length)]
  60 + user.person.data[:country] = place[:country]
  61 + user.person.city = place[:city]
  62 + user.person.lat = place[:lat] + (rand/100)-0.005
  63 + user.person.lng = place[:lng] + (rand/100)-0.005
30 64 user.person.save!
31 65 people << user.person
32 66  
... ...