forked from AdaGold/grocery-store
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add seeds file in case we ever want to adjust the csv files
- Loading branch information
1 parent
6ef0da2
commit 6aedf8f
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require 'csv' | ||
require 'faker' | ||
|
||
|
||
# Students do not need to modify this file | ||
# This is the file created by instructors to create all CSV files | ||
|
||
# orders | ||
# id = 1 | ||
# CSV.open("support/orders.csv", "w") do |csv| | ||
# 100.times do | ||
# foods = "" | ||
# rand(1..4).times do | ||
# foods += Faker::Food.ingredient + ":" + Faker::Commerce.price.to_s + ";" | ||
# end | ||
# | ||
# foods = foods.chomp(';') | ||
# csv << [id, foods] | ||
# id += 1 | ||
# end | ||
# end | ||
|
||
# customers | ||
# id = 1 | ||
# CSV.open("support/customers.csv", "w") do |csv| | ||
# 35.times do | ||
# csv << [id, Faker::Internet.email, | ||
# Faker::Address.street_address, Faker::Address.city, Faker::Address.state_abbr, Faker::Address.zip_code] | ||
# id += 1 | ||
# end | ||
# end | ||
|
||
# online orders | ||
# id = 1 | ||
# statuses = %i(pending paid processing shipped complete) | ||
# CSV.open("support/online_orders.csv", "w") do |csv| | ||
# 100.times do | ||
# foods = "" | ||
# rand(1..4).times do | ||
# foods += Faker::Food.ingredient + ":" + Faker::Commerce.price.to_s + ";" | ||
# end | ||
# | ||
# foods = foods.chomp(';') | ||
# # id, string of foods, customer ID, random status | ||
# csv << [id, foods, rand(1..35), statuses.sample] | ||
# id += 1 | ||
# end | ||
# end |