Commit 6a8fe6bb9a2f7ab2a494e3ec614d97e24a6ff7e3
1 parent
86514f9d
Exists in
master
and in
29 other branches
Add state for some places and place for some communities
ActionItem2350
Showing
1 changed file
with
19 additions
and
8 deletions
Show diff stats
script/sample-profiles
@@ -5,20 +5,24 @@ include Noosfero::SampleDataHelper | @@ -5,20 +5,24 @@ include Noosfero::SampleDataHelper | ||
5 | categories = $environment.categories | 5 | categories = $environment.categories |
6 | 6 | ||
7 | places = [ | 7 | places = [ |
8 | - { :country=>'BR', :city=>'Salvador', | 8 | + { :country=>'BR', :state=>'Bahia', :city=>'Salvador', |
9 | :lat=>-12.94032, :lng=>-38.58398 }, | 9 | :lat=>-12.94032, :lng=>-38.58398 }, |
10 | - { :country=>'BR', :city=>'São Paulo', | 10 | + { :country=>'BR', :state=>'Bahia', :city=>'Feira de Santana', |
11 | + :lat=>-12.25547, :lng=>-38.95430 }, | ||
12 | + { :country=>'BR', :state=>'São Paulo', :city=>'São Paulo', | ||
11 | :lat=>-23.54894, :lng=>-46.63881 }, | 13 | :lat=>-23.54894, :lng=>-46.63881 }, |
12 | - { :country=>'BR', :city=>'Rio de Janeiro', | ||
13 | - :lat=>-22.90353, :lng=>-43.20958 }, | ||
14 | - { :country=>'AR', :city=>'Buenos Aires', | 14 | + { :country=>'BR', :state=>'Rio de Janeiro', :city=>'Petrópolis', |
15 | + :lat=>-22.50462, :lng=>-43.18232 }, | ||
16 | + { :country=>'AR', :state=>'A.C.', :city=>'Buenos Aires', | ||
15 | :lat=>-34.61088, :lng=>-58.39782 }, | 17 | :lat=>-34.61088, :lng=>-58.39782 }, |
16 | - { :country=>'AR', :city=>'Mar del Plata', | 18 | + { :country=>'AR', :state=>'Buenos Aires', :city=>'Mar del Plata', |
17 | :lat=>-37.98317, :lng=>-57.59513 }, | 19 | :lat=>-37.98317, :lng=>-57.59513 }, |
18 | - { :country=>'MX', :city=>'Acapulco', | 20 | + { :country=>'MX', :state=>'Guerrero', :city=>'Acapulco', |
19 | :lat=>16.86369, :lng=>-99.88151 }, | 21 | :lat=>16.86369, :lng=>-99.88151 }, |
20 | - { :country=>'US', :city=>'Los Angeles', | 22 | + { :country=>'US', :state=>'California', :city=>'Los Angeles', |
21 | :lat=>34.02307, :lng=>-118.24310 }, | 23 | :lat=>34.02307, :lng=>-118.24310 }, |
24 | + { :country=>'US', :state=>'Florida', :city=>'Jacksonville', | ||
25 | + :lat=>30.33217, :lng=>-81.65566 }, | ||
22 | { :country=>'IT', :city=>'Roma', | 26 | { :country=>'IT', :city=>'Roma', |
23 | :lat=>41.89512, :lng=>12.48184 }, | 27 | :lat=>41.89512, :lng=>12.48184 }, |
24 | { :country=>'IN', :city=>'Mumbai', | 28 | { :country=>'IN', :city=>'Mumbai', |
@@ -51,6 +55,7 @@ for name in NAMES | @@ -51,6 +55,7 @@ for name in NAMES | ||
51 | user.person.name = full_name | 55 | user.person.name = full_name |
52 | place = places[rand(places.length)] | 56 | place = places[rand(places.length)] |
53 | user.person.data[:country] = place[:country] | 57 | user.person.data[:country] = place[:country] |
58 | + user.person.state = place[:state] | ||
54 | user.person.city = place[:city] | 59 | user.person.city = place[:city] |
55 | user.person.lat = place[:lat] + (rand/100)-0.005 | 60 | user.person.lat = place[:lat] + (rand/100)-0.005 |
56 | user.person.lng = place[:lng] + (rand/100)-0.005 | 61 | user.person.lng = place[:lng] + (rand/100)-0.005 |
@@ -128,6 +133,12 @@ for verb in VERBS | @@ -128,6 +133,12 @@ for verb in VERBS | ||
128 | for stuff in STUFF | 133 | for stuff in STUFF |
129 | name = [verb, stuff].join(' ') | 134 | name = [verb, stuff].join(' ') |
130 | community = Community.new(:name => name, :environment => $environment) | 135 | community = Community.new(:name => name, :environment => $environment) |
136 | + if rand(2)==1 # not all communities must have a place | ||
137 | + place = places[rand(places.length)] | ||
138 | + community.data[:country] = place[:country] | ||
139 | + community.state = place[:state] | ||
140 | + community.city = place[:city] | ||
141 | + end | ||
131 | save community do | 142 | save community do |
132 | communities << community | 143 | communities << community |
133 | rand(10).times do | 144 | rand(10).times do |