Skip to content

Commit 379c314

Browse files
committed
Fix paths for random_data generation script
1 parent 1e37851 commit 379c314

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

data/random_data.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def credit_card
1515
end
1616

1717
def funds(m)
18-
(1..m).each do |n|
18+
(1..m).each do |n|
1919
amount = Random.rand(1000.0)
2020
parent = gen_id
2121
parent_name = Faker::Company.name
@@ -42,8 +42,8 @@ def ratings(m)
4242

4343
def ships_and_containers(m, p)
4444
puts ['ship_imo', 'ship_name', 'country', 'departure', 'container_id', 'container_type', 'container_group', 'net_weight', 'gross_weight', 'owner', 'declared', 'contact', 'customs_ok'].join(";")
45-
container_codes = CSV.read('./data/iso-container-codes.csv').map { |m| m[0] }.drop(1)
46-
container_groups = CSV.read('./data/iso-container-groups.csv').map { |m| m[0] }.drop(1)
45+
container_codes = CSV.read('./iso-container-codes.csv').map { |m| m[0] }.drop(1)
46+
container_groups = CSV.read('./iso-container-groups.csv').map { |m| m[0] }.drop(1)
4747
(1..m).each do |n|
4848
ship_imo = gen_id(3, 1000000)
4949
ship_name = [Faker::Name.first_name, Faker::Address.city].sample
@@ -70,22 +70,22 @@ def ships_and_containers(m, p)
7070

7171
def shop(m)
7272
puts ['tx_id', 'tx_time', 'buyer', 'currency_code', 'payment_type', 'credit_card_number', 'country', 'department', 'product', 'item_price', 'coupon_code', 'was_returned'].join('|')
73-
(1..m).each do |n|
73+
(1..m).each do |n|
7474
buyer = Faker::Name.name
7575
tx_id = gen_id(7, 100)
7676
tx_time = time_rand Time.local(2010, 1, 1), Time.local(2010, 12, 31)
7777
cc = credit_card()
7878
price = Faker::Commerce.price
7979
currency = ['USD', 'EUR', 'JPY', 'AUD', 'CAD', 'GBP'].sample
80-
payment = ['VISA', 'MASTERCARD', 'AMERICAN_EXPRESS', 'DANKORT', 'JCB', 'FORBRUGSFORENINGEN'].sample
80+
payment = ['VISA', 'MASTERCARD', 'AMERICAN_EXPRESS', 'DANKORT', 'JCB', 'FORBRUGSFORENINGEN'].sample
8181
country = Faker::Address.country_code
8282
divisions = [0, 0, Random.rand(5)].sample
8383
positions = [0] + (0..divisions-1).map { |d| Random.rand(1.0) }.sort + [1]
8484
positions.each_cons(2) do |pos|
8585
percent = pos[1] - pos[0]
8686
item_price = (price*percent).round(2)
8787
department = Faker::Commerce.department(1, true)
88-
product = Faker::Commerce.product_name
88+
product = Faker::Commerce.product_name
8989
coupon = [false, false, true, false].sample
9090
coupon_code = ''
9191
if (coupon)
@@ -100,4 +100,4 @@ def shop(m)
100100

101101
# shop(1000)
102102
# ships_and_containers(20, 2)
103-
ratings(10000)
103+
# ratings(10000)

0 commit comments

Comments
 (0)