From 2f0b67cfd7de034431013869814570625d749db6 Mon Sep 17 00:00:00 2001 From: noglows Date: Mon, 19 Oct 2015 16:27:20 -0700 Subject: [PATCH 01/35] Added self.all and self.find methods and specs for Market and Product class --- lib/far_mar.rb | 1 + lib/far_mar/market.rb | 36 +++++++++++++++++++++++++++++++++++- lib/far_mar/product.rb | 27 +++++++++++++++++++++++++++ spec/far_mar/market_spec.rb | 22 ++++++++++++++++++++-- spec/far_mar/product_spec.rb | 20 ++++++++++++++++++-- 5 files changed, 101 insertions(+), 5 deletions(-) diff --git a/lib/far_mar.rb b/lib/far_mar.rb index e6c42078..15571bd0 100644 --- a/lib/far_mar.rb +++ b/lib/far_mar.rb @@ -1,5 +1,6 @@ require "csv" require "time" +require "pry" require "./lib/far_mar/market" require "./lib/far_mar/vendor" diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index d7c55e3b..31b1e71e 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -1,5 +1,39 @@ module FarMar class Market - #market_csv = CSV.read("support/markets.csv") + + attr_accessor :id, :name, :address, :city, :county, :state, :zip, :markets + def initialize(market_hash) + @id = market_hash[:id].to_i + @name = market_hash[:name] + @address = market_hash[:address] + @city = market_hash[:city] + @county = market_hash[:county] + @state = market_hash[:state] + @zip = market_hash[:zip] + end + + def self.all + @markets = [] + markets_csv = CSV.read("support/markets.csv") + + markets_csv.each do |id, name, address, city, county, state, zip| + hash = {:id => id, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} + market = FarMar::Market.new(hash) + @markets.push(market) + + end + return @markets + end + + def self.find(id) + @markets.find do |market| + market.id == id + end + end + + def vendors + ## NEED TO WRITE THIS METHOD ONCE VENDORS IS BETTER DEFINED + end + end end diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index 20c6d1b7..0655e317 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -1,5 +1,32 @@ module FarMar class Product #product_csv = CSV.read("support/products.csv") + attr_accessor :product_id, :product_name, :vendor_id + def initialize(product_hash) + @product_id = product_hash[:id] + @product_name = product_hash[:name] + @vendor_id = product_hash[:vendor_id] + end + + def self.all + @products = [] + products_csv = CSV.read("support/products.csv") + + products_csv.each do |id, name, vendor_id| + hash = {:id => id, :name => name, :vendor_id => vendor_id} + product = FarMar::Product.new(hash) + @products.push(product) + end + return @products + end + + def self.find(id) + @products.find do |product| + product.product_id == id + end + end + + + end end diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index c71002df..a6021e4f 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -2,12 +2,30 @@ describe FarMar::Market do before :each do - @market = FarMar::Market.new + @markets = FarMar::Market.all + end describe "#new" do it "create a new instance of Market" do - expect(@market).to be_an_instance_of FarMar::Market + example_market_hash = {:name => "Test Market", :id => 77, :address => "123 Test Street", :city => "Testland", :county => "Test County", :state => "WV", :zip => "00000"} + test_market = FarMar::Market.new(example_market_hash) + + expect(test_market).to be_an_instance_of FarMar::Market + end + end + + describe ".all" do + it "creates a market object for every market listed in the datafile" do + csv = CSV.read("support/markets.csv") + expect(@markets.length).to eq csv.length + end + end + + describe ".find" do + it "can find a market object with a given ID" do + test_id = @markets[2].id + expect(FarMar::Market.find(test_id)).to eq @markets[2] end end end diff --git a/spec/far_mar/product_spec.rb b/spec/far_mar/product_spec.rb index bed51385..d5dce3d2 100644 --- a/spec/far_mar/product_spec.rb +++ b/spec/far_mar/product_spec.rb @@ -2,12 +2,28 @@ describe FarMar::Product do before :each do - @product = FarMar::Product.new + @products = FarMar::Product.all end describe "#new" do it "create a new instance of Product" do - expect(@product).to be_an_instance_of FarMar::Product + example_product_hash = {:id => 5, :name => "Test Product", :vendor_id => "25"} + example_product = FarMar::Product.new(example_product_hash) + expect(example_product).to be_an_instance_of FarMar::Product + end + end + + describe ".all" do + it "creates a product object for every product listed in the datafile" do + csv = CSV.read("support/products.csv") + expect(@products.length).to eq csv.length + end + end + + describe ".find" do + it "can find a product object with a given ID" do + test_id = @products[2].product_id + expect(FarMar::Product.find(test_id)).to eq @products[2] end end end From db8ebaae6471d1921e7faba2e6476968f1374e52 Mon Sep 17 00:00:00 2001 From: noglows Date: Tue, 20 Oct 2015 16:02:04 -0700 Subject: [PATCH 02/35] Finished code/specs for all and find methods. Added vendor method to Market --- To-Do.txt | 5 +++++ lib/far_mar/market.rb | 7 +++++-- lib/far_mar/sale.rb | 26 ++++++++++++++++++++++++++ lib/far_mar/vendor.rb | 28 +++++++++++++++++++++++++++- spec/far_mar/market_spec.rb | 17 +++++++++++++++++ spec/far_mar/sale_spec.rb | 21 +++++++++++++++++++-- spec/far_mar/vendor_spec.rb | 21 +++++++++++++++++++-- 7 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 To-Do.txt diff --git a/To-Do.txt b/To-Do.txt new file mode 100644 index 00000000..c9626939 --- /dev/null +++ b/To-Do.txt @@ -0,0 +1,5 @@ +# Need to check data types for CSV input in Market +# Need to check data types for CSV input in product +# Need to deal with Date Time for CSV input in Sale +# Check accessors +# Improve vendors spec diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 31b1e71e..14502c3f 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -32,8 +32,11 @@ def self.find(id) end def vendors - ## NEED TO WRITE THIS METHOD ONCE VENDORS IS BETTER DEFINED + vendors = FarMar::Vendor.all + matched_vendors = vendors.find_all do |vendor| + vendor.market_id == self.id + end + return matched_vendors end - end end diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index d73c56f8..9607ec24 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -1,5 +1,31 @@ module FarMar class Sale #sale_csv = CSV.read("support/sales.csv") + attr_accessor :sale_id + def initialize(sale_hash) + @sale_id = sale_hash[:id].to_i + @amount = sale_hash[:amount].to_i + @purchase_time = sale_hash[:purchase_time] ### NEEDS TO BE DATETIME + @vendor_id = sale_hash[:vendor_id].to_i + @product_id = sale_hash[:product_id].to_i + end + + def self.all + @sales = [] + sales_csv = CSV.read("support/sales.csv") + + sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| + hash = {:id => id, :amount => amount, :purchase_time => purchase_time, :vendor_id => vendor_id, :product_id => product_id} + sale = FarMar::Sale.new(hash) + @sales.push(sale) + end + return @sales + end + + def self.find(id) + @sales.find do |sale| + sale.sale_id == id + end + end end end diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 31ca75cc..79594d28 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -1,5 +1,31 @@ module FarMar class Vendor - #vendor_csv = CSV.read("support/vendors.csv") + + attr_accessor :vendors, :vendor_id, :market_id + def initialize(vendor_hash) + @vendor_id = vendor_hash[:id].to_i + @vendor_name = vendor_hash[:name] + @num_of_employees = vendor_hash[:employees] + @market_id = vendor_hash[:market_id].to_i + end + + def self.all + @vendors = [] + vendors_csv = CSV.read("support/vendors.csv") + + vendors_csv.each do |id, name, num_employees, market_id| + hash = {:id => id, :name => name, :employees => num_employees, :market_id => market_id} + vendor = FarMar::Vendor.new(hash) + @vendors.push(vendor) + end + return @vendors + end + + def self.find(id) + @vendors.find do |vendor| + vendor.vendor_id == id + end + end + end end diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index a6021e4f..09445bea 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -28,4 +28,21 @@ expect(FarMar::Market.find(test_id)).to eq @markets[2] end end + + describe "#vendors" do + it "does not return nil" do + sample_market_id = 1 + sample_market = FarMar::Market.find(sample_market_id) + matched_vendors = FarMar::Vendor.all + matched_vendors = matched_vendors.find_all { |vendor| vendor.market_id == sample_market_id} + expect(sample_market.vendors).not_to eq [] + end + it "returns all vendors associated with market_id" do + sample_market_id = 1 + matched_vendors = FarMar::Vendor.all + sample_market = FarMar::Market.find(sample_market_id) + matched_vendors = matched_vendors.find_all { |vendor| vendor.market_id == sample_market_id} + expect(sample_market.vendors.length).to eq matched_vendors.length + end + end end diff --git a/spec/far_mar/sale_spec.rb b/spec/far_mar/sale_spec.rb index f3e24d3e..849b5571 100644 --- a/spec/far_mar/sale_spec.rb +++ b/spec/far_mar/sale_spec.rb @@ -2,12 +2,29 @@ describe FarMar::Sale do before :each do - @sale = FarMar::Sale.new + @sales = FarMar::Sale.all end describe "#new" do it "create a new instance of Sale" do - expect(@sale).to be_an_instance_of FarMar::Sale + example_sale_hash = {:id => 1111, :amount => 5678, :purchase_time => "a date", :vendor_id => 1, :product_id => 3} # NEED TO BUILD THE HASH + example_sale = FarMar::Sale.new(example_sale_hash) + expect(example_sale).to be_an_instance_of FarMar::Sale end end + + +describe ".all" do + it "creates a sale object for every sale listed in the datafile" do + csv = CSV.read("support/sales.csv") + expect(@sales.length).to eq csv.length + end +end + +describe ".find" do + it "can find a sale object with a given ID" do + test_id = @sales[2].sale_id + expect(FarMar::Sale.find(test_id)).to eq @sales[2] + end +end end diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index 7c75c73e..cac0f230 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -2,12 +2,29 @@ describe FarMar::Vendor do before :each do - @vendor = FarMar::Vendor.new + @vendors = FarMar::Vendor.all end describe "#new" do it "create a new instance of Vendor" do - expect(@vendor).to be_an_instance_of FarMar::Vendor + sample_vendor_hash = {:id => 100, :name => "Test Testerson", :employees => 5000, :market_id => 4} + sample_vendor = FarMar::Vendor.new(sample_vendor_hash) + expect(sample_vendor).to be_an_instance_of FarMar::Vendor end end + + describe ".all" do + it "creates a vendor object for every vendor listed in the datafile" do + csv = CSV.read("support/vendors.csv") + expect(@vendors.length).to eq csv.length + end + end + + describe ".find" do + it "can find a vendor object with a given ID" do + test_id = @vendors[2].vendor_id + expect(FarMar::Vendor.find(test_id)).to eq @vendors[2] + end + end + end From d19bcfd2f65002d452999495fd032ae0a96cea5e Mon Sep 17 00:00:00 2001 From: noglows Date: Tue, 20 Oct 2015 16:03:25 -0700 Subject: [PATCH 03/35] Updated the to-do list --- To-Do.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/To-Do.txt b/To-Do.txt index c9626939..b484e281 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -2,4 +2,4 @@ # Need to check data types for CSV input in product # Need to deal with Date Time for CSV input in Sale # Check accessors -# Improve vendors spec +# Improve #vendors spec - suspect this could be written more efficiently From c1bdb5332f13aed95f274aa3066a12d83717251b Mon Sep 17 00:00:00 2001 From: noglows Date: Tue, 20 Oct 2015 16:11:12 -0700 Subject: [PATCH 04/35] Added the market method to Vendor class and added associated specs --- lib/far_mar/vendor.rb | 5 +++++ spec/far_mar/vendor_spec.rb | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 79594d28..136d122c 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -27,5 +27,10 @@ def self.find(id) end end + # Returns the FarMar::Market instance that is associated with the vendor + def market + FarMar::Market.find(self.market_id) + end + end end diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index cac0f230..92ca99ed 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -27,4 +27,16 @@ end end + describe "#market" do + it "returns a market object for the current vendor" do + vendor = @vendors[1] + expect(vendor.market).to be_an_instance_of FarMar::Market + end + + it "returns the correct market object for a vendor" do + vendor = @vendors[1] + expect(vendor.market.name).to eq "People's Co-op Farmers Market" + end + end + end From a39dfa91203d6fa4f54c960a9e4995fe0133f8b0 Mon Sep 17 00:00:00 2001 From: noglows Date: Tue, 20 Oct 2015 16:37:40 -0700 Subject: [PATCH 05/35] Added self.by_market method for Vendor class --- To-Do.txt | 2 ++ lib/far_mar/vendor.rb | 22 ++++++++++++++++++++++ spec/far_mar/vendor_spec.rb | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/To-Do.txt b/To-Do.txt index b484e281..b68d9e4b 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -3,3 +3,5 @@ # Need to deal with Date Time for CSV input in Sale # Check accessors # Improve #vendors spec - suspect this could be written more efficiently +# Write the product method for vendor +# Rewrite the vendor by_market spec - using length but should be testing result accuracy diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 136d122c..af0689c1 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -9,6 +9,7 @@ def initialize(vendor_hash) @market_id = vendor_hash[:market_id].to_i end + # Returns a collection of Vendor instances, representing all the vendors described in the CSV def self.all @vendors = [] vendors_csv = CSV.read("support/vendors.csv") @@ -21,6 +22,7 @@ def self.all return @vendors end + # Returns an instance of Vendor that matches the search ID def self.find(id) @vendors.find do |vendor| vendor.vendor_id == id @@ -32,5 +34,25 @@ def market FarMar::Market.find(self.market_id) end + # Returns a collection of FarMar::Product instances that are associated with the vendor + def products + ## COME BACK TO THIS METHOD ONCE PRODUCT HAS BEEN BUILT OUT + end + + # Returns a collection of FarMar::Sale instances that are associated with the vendor + def sales + ## COME BACK TO THIS METHOD ONCE SALES HAS BEEN BUILT OUT + end + + # Returns the sum of all the vendor's sale (in cents) + def revenue + end + + # Returns all of the vendors with the given market ID + def self.by_market(market_id) + vendors = FarMar::Vendor.all + matched_vendors = vendors.find_all { |vendor| vendor.market_id == market_id} + return matched_vendors + end end end diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index 92ca99ed..c4f50214 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -39,4 +39,16 @@ end end + describe ".by_market" do + it "does not return nil" do + test_market = 1 + expect(FarMar::Vendor.by_market(test_market)).not_to eq [] + end + + it "returns the correct number of vendors" do + test_market = FarMar::Market.find(1) + vendors_for_market = test_market.vendors + expect(FarMar::Vendor.by_market(1).length).to eq vendors_for_market.length + end + end end From a454df56cbfe6a8001f1949050794732dd589880 Mon Sep 17 00:00:00 2001 From: noglows Date: Tue, 20 Oct 2015 16:58:07 -0700 Subject: [PATCH 06/35] Added vendor method to Product class --- lib/far_mar/product.rb | 23 ++++++++++++++++++++--- lib/far_mar/vendor.rb | 2 +- spec/far_mar/product_spec.rb | 14 ++++++++++++++ spec/far_mar/vendor_spec.rb | 12 ++++++------ 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index 0655e317..34305fc6 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -1,13 +1,14 @@ module FarMar class Product - #product_csv = CSV.read("support/products.csv") + attr_accessor :product_id, :product_name, :vendor_id def initialize(product_hash) - @product_id = product_hash[:id] + @product_id = product_hash[:id].to_i @product_name = product_hash[:name] - @vendor_id = product_hash[:vendor_id] + @vendor_id = product_hash[:vendor_id].to_i end + # Return a collection of all Product instances, representing all the products described in the CSV def self.all @products = [] products_csv = CSV.read("support/products.csv") @@ -20,13 +21,29 @@ def self.all return @products end + # Returns an instance of Product with the passed in ID def self.find(id) @products.find do |product| product.product_id == id end end + # Returns the FarMar::Vendor instance that is associated with the product + def vendor + FarMar::Vendor.find(self.vendor_id) + end + + # Returns a collection for FarMar::Sale instances associated with the product + def sales + end + # Returns the number of times this product has been sold + def number_of_sales + end + + # Returns all of the products with the given Vendor ID + def self.by_vendor(vendor_id) + end end end diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index af0689c1..91b3ce74 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -1,7 +1,7 @@ module FarMar class Vendor - attr_accessor :vendors, :vendor_id, :market_id + attr_accessor :vendors, :vendor_id, :market_id, :vendor_name def initialize(vendor_hash) @vendor_id = vendor_hash[:id].to_i @vendor_name = vendor_hash[:name] diff --git a/spec/far_mar/product_spec.rb b/spec/far_mar/product_spec.rb index d5dce3d2..7df04a23 100644 --- a/spec/far_mar/product_spec.rb +++ b/spec/far_mar/product_spec.rb @@ -26,4 +26,18 @@ expect(FarMar::Product.find(test_id)).to eq @products[2] end end + + describe "#vendor" do + it "returns a vendor object for the current product" do + @products = FarMar::Product.all + product = @products[1] + expect(product.vendor).to be_an_instance_of FarMar::Vendor + end + + it "returns the correct vendor object for a product" do + product = @products[1] + expect(product.vendor.vendor_name).to eq "Hamill, Kilback and Pfeffer" + end + end + end diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index c4f50214..157b33f8 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -20,12 +20,12 @@ end end - describe ".find" do - it "can find a vendor object with a given ID" do - test_id = @vendors[2].vendor_id - expect(FarMar::Vendor.find(test_id)).to eq @vendors[2] - end - end + # describe ".find" do + # it "can find a vendor object with a given ID" do + # test_id = @vendors[2].vendor_id + # expect(FarMar::Vendor.find(test_id)).to eq @vendors[2] + # end + # end describe "#market" do it "returns a market object for the current vendor" do From 052352c711d48238aeaf43303e493c06d1b71786 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 10:34:07 -0700 Subject: [PATCH 07/35] Added vendor and product methods to Sale class --- lib/far_mar/sale.rb | 19 ++++++++++++++++++- spec/far_mar/sale_spec.rb | 25 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index 9607ec24..71d74a25 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -1,7 +1,7 @@ module FarMar class Sale #sale_csv = CSV.read("support/sales.csv") - attr_accessor :sale_id + attr_accessor :sale_id, :vendor_id, :product_id def initialize(sale_hash) @sale_id = sale_hash[:id].to_i @amount = sale_hash[:amount].to_i @@ -10,6 +10,7 @@ def initialize(sale_hash) @product_id = sale_hash[:product_id].to_i end + # Returns a collection of Sale instances, representing all of the sales described in the CSV def self.all @sales = [] sales_csv = CSV.read("support/sales.csv") @@ -22,10 +23,26 @@ def self.all return @sales end + # Returns an instance of Sale where the value of the ID field matches the passed parameter def self.find(id) @sales.find do |sale| sale.sale_id == id end end + + # Returns the FarMar::Vendor instance associated with this sale + def vendor + FarMar::Vendor.find(self.vendor_id) + end + + # Returns the FarMar::Product instance associated with this sale + def product + FarMar::Product.find(self.product_id) + end + + # Returns a collection of FarMar::Sale objects where the purchase time is between the two given times + def self.between(beginning_time, end_time) + end + end end diff --git a/spec/far_mar/sale_spec.rb b/spec/far_mar/sale_spec.rb index 849b5571..24cf5b26 100644 --- a/spec/far_mar/sale_spec.rb +++ b/spec/far_mar/sale_spec.rb @@ -27,4 +27,29 @@ expect(FarMar::Sale.find(test_id)).to eq @sales[2] end end + +describe "#vendor" do + it "returns a vendor object for the current sale" do + sale = @sales[1] + expect(sale.vendor).to be_an_instance_of FarMar::Vendor + end + + it "returns the correct vendor object for a sale" do + sale = @sales[1] + expect(sale.vendor.vendor_name).to eq "Feil-Farrell" + end +end + +describe "#product" do + it "returns a product object for the current sale" do + sale = @sales[1] + expect(sale.product).to be_an_instance_of FarMar::Product + end + + it "returns the correct product object for a sale" do + sale = @sales[1] + expect(sale.product.product_name).to eq "Dry Beets" + end +end + end From 673450fd97a6caec82d688575df8268813d9f852 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 10:42:31 -0700 Subject: [PATCH 08/35] Added sales method to Vendor class --- lib/far_mar/vendor.rb | 4 +++- spec/far_mar/vendor_spec.rb | 25 +++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 91b3ce74..41c699b8 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -41,7 +41,9 @@ def products # Returns a collection of FarMar::Sale instances that are associated with the vendor def sales - ## COME BACK TO THIS METHOD ONCE SALES HAS BEEN BUILT OUT + sales = FarMar::Sale.all + matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id} + return matched_sales end # Returns the sum of all the vendor's sale (in cents) diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index 157b33f8..f7e4fe6c 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -20,12 +20,12 @@ end end - # describe ".find" do - # it "can find a vendor object with a given ID" do - # test_id = @vendors[2].vendor_id - # expect(FarMar::Vendor.find(test_id)).to eq @vendors[2] - # end - # end + describe ".find" do + it "can find a vendor object with a given ID" do + test_id = @vendors[2].vendor_id + expect(FarMar::Vendor.find(test_id)).to eq @vendors[2] + end + end describe "#market" do it "returns a market object for the current vendor" do @@ -51,4 +51,17 @@ expect(FarMar::Vendor.by_market(1).length).to eq vendors_for_market.length end end + + describe "#sales" do + it "does not return an empty array" do + test_vendor = FarMar::Vendor.find(1) + expect(test_vendor.sales).not_to eq [] + end + + it "returns the correct number of sales" do + test_vendor = FarMar::Vendor.find(1) + expect(test_vendor.sales.length).to eq 7 + + end + end end From d67d913b492dfb8f4f78b0c13931ef358b581ff2 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 10:42:55 -0700 Subject: [PATCH 09/35] Added spec for Vendor sales method --- spec/far_mar/vendor_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index f7e4fe6c..8d289fed 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -61,7 +61,6 @@ it "returns the correct number of sales" do test_vendor = FarMar::Vendor.find(1) expect(test_vendor.sales.length).to eq 7 - end end end From 2d7ee1f84cdbcb714bd3da726c9b58800b4151c3 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 10:48:31 -0700 Subject: [PATCH 10/35] Added a product method to the Vendor class --- lib/far_mar/vendor.rb | 4 +++- spec/far_mar/vendor_spec.rb | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 41c699b8..92b87673 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -36,7 +36,9 @@ def market # Returns a collection of FarMar::Product instances that are associated with the vendor def products - ## COME BACK TO THIS METHOD ONCE PRODUCT HAS BEEN BUILT OUT + products = FarMar::Product.all + matched_products = products.find_all { |product| product.vendor_id == self.vendor_id } + return matched_products end # Returns a collection of FarMar::Sale instances that are associated with the vendor diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index 8d289fed..d6078cde 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -52,6 +52,20 @@ end end + describe "#products" do + it "does not return an empty array" do + test_vendor = FarMar::Vendor.find(1) + expect(test_vendor.products).not_to eq [] + end + + it "returns the correct array of products" do + test_vendor = FarMar::Vendor.find(2) + expect(test_vendor.products[0].product_name).to eq "Fierce Greens" + expect(test_vendor.products[1].product_name).to eq "Heavy Chicken" + expect(test_vendor.products.length).to eq 2 + end + end + describe "#sales" do it "does not return an empty array" do test_vendor = FarMar::Vendor.find(1) From 55ae21b461bdd43f0053a116f066341744d8c372 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 10:54:28 -0700 Subject: [PATCH 11/35] Added revenue method to Vendor class --- lib/far_mar/sale.rb | 2 +- lib/far_mar/vendor.rb | 6 ++++++ spec/far_mar/vendor_spec.rb | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index 71d74a25..8a213100 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -1,7 +1,7 @@ module FarMar class Sale #sale_csv = CSV.read("support/sales.csv") - attr_accessor :sale_id, :vendor_id, :product_id + attr_accessor :sale_id, :vendor_id, :product_id, :amount def initialize(sale_hash) @sale_id = sale_hash[:id].to_i @amount = sale_hash[:amount].to_i diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 92b87673..a9148416 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -50,6 +50,12 @@ def sales # Returns the sum of all the vendor's sale (in cents) def revenue + total = 0 + all_sales = self.sales + all_sales.each do |sale| + total += sale.amount + end + return total end # Returns all of the vendors with the given market ID diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index d6078cde..7449bb8c 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -77,4 +77,16 @@ expect(test_vendor.sales.length).to eq 7 end end + + describe "#revenue" do + it "returns a fixnum value" do + test_vendor = FarMar::Vendor.find(1) + expect(test_vendor.revenue).to be_an_instance_of Fixnum + end + + it "returns the correct value for example data" do + test_vendor = FarMar::Vendor.find(1) + expect(test_vendor.revenue).to eq 38259 + end + end end From a398ec2f9ed1e18980131208a75301f17f5f30ac Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 11:14:43 -0700 Subject: [PATCH 12/35] Added sales method to Product class --- To-Do.txt | 1 + lib/far_mar/product.rb | 3 +++ spec/far_mar/product_spec.rb | 12 ++++++++++++ 3 files changed, 16 insertions(+) diff --git a/To-Do.txt b/To-Do.txt index b68d9e4b..d455fb34 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -5,3 +5,4 @@ # Improve #vendors spec - suspect this could be written more efficiently # Write the product method for vendor # Rewrite the vendor by_market spec - using length but should be testing result accuracy +# Rewrite tests to take test data diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index 34305fc6..a6ae8243 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -35,6 +35,9 @@ def vendor # Returns a collection for FarMar::Sale instances associated with the product def sales + all_sales = FarMar::Sale.all + matched_sales = all_sales.find_all { |sale| sale.product_id == self.product_id } + return matched_sales end # Returns the number of times this product has been sold diff --git a/spec/far_mar/product_spec.rb b/spec/far_mar/product_spec.rb index 7df04a23..dd15a6d7 100644 --- a/spec/far_mar/product_spec.rb +++ b/spec/far_mar/product_spec.rb @@ -40,4 +40,16 @@ end end + describe "#sales" do + it "does not return an empty array" do + product = @products[0] + expect(product.sales).not_to eq [] + end + + it "returns the expected number of sales" do + product = @products[0] + expect(product.sales.length).to eq 7 + end + end + end From 8b4e86f52253844e460852c0fdab99c591aa1478 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 11:16:59 -0700 Subject: [PATCH 13/35] Added number_of_sales method to Product --- lib/far_mar/product.rb | 1 + spec/far_mar/product_spec.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index a6ae8243..4fe5b2fa 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -42,6 +42,7 @@ def sales # Returns the number of times this product has been sold def number_of_sales + return self.sales.length end # Returns all of the products with the given Vendor ID diff --git a/spec/far_mar/product_spec.rb b/spec/far_mar/product_spec.rb index dd15a6d7..dcf928cd 100644 --- a/spec/far_mar/product_spec.rb +++ b/spec/far_mar/product_spec.rb @@ -52,4 +52,11 @@ end end + describe "#number_of_sales" do + it "returns the expected number of sales" do + product = @products[0] + expect(product.number_of_sales).to eq 7 + end + end + end From 5fc02cfad73cd969dbe9aabafd21bd88edc9edd8 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 11:29:33 -0700 Subject: [PATCH 14/35] Added the self.by_vendor method to the Product class --- lib/far_mar/product.rb | 3 +++ spec/far_mar/product_spec.rb | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index 4fe5b2fa..3b183104 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -47,6 +47,9 @@ def number_of_sales # Returns all of the products with the given Vendor ID def self.by_vendor(vendor_id) + all_products = FarMar::Product.all + matched_products = all_products.find_all { |product| product.vendor_id == vendor_id } + return matched_products end end diff --git a/spec/far_mar/product_spec.rb b/spec/far_mar/product_spec.rb index dcf928cd..7a969d0c 100644 --- a/spec/far_mar/product_spec.rb +++ b/spec/far_mar/product_spec.rb @@ -59,4 +59,17 @@ end end + describe ".by_vendor" do + it "returns an array of vendor objects" do + vendor_id = 1 + expect(FarMar::Product.by_vendor(vendor_id)).to be_an_instance_of Array + expect(FarMar::Product.by_vendor(vendor_id)).not_to eq [] + end + + it "returns the expected vendors" do + vendor_id = 2 + expect(FarMar::Product.by_vendor(vendor_id).length).to eq 2 + end + end + end From 0c3ba3e1f6eea19d54688f8961bc7f0617498c69 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 14:04:57 -0700 Subject: [PATCH 15/35] Added the self.between method to the Sale class --- To-Do.txt | 13 +++++++++++++ lib/far_mar/sale.rb | 15 +++++++++++++-- spec/far_mar/sale_spec.rb | 20 +++++++++++++++++++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/To-Do.txt b/To-Do.txt index d455fb34..55a11789 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -6,3 +6,16 @@ # Write the product method for vendor # Rewrite the vendor by_market spec - using length but should be testing result accuracy # Rewrite tests to take test data +# Hailey's efficiency code: + def self.all + @@markets_all ||= [] + if @@markets_all == [] + CSV.read("support/markets.csv").each do |id, name, address, city, county, state, zip| + #binding.pry + market_hash = {:id => id.to_i, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} + market = FarMar::Market.new(market_hash) + @@markets_all.push(market) + end + end + return @@markets_all + end diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index 8a213100..e6d5d844 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -1,11 +1,12 @@ module FarMar class Sale #sale_csv = CSV.read("support/sales.csv") - attr_accessor :sale_id, :vendor_id, :product_id, :amount + attr_accessor :sale_id, :vendor_id, :product_id, :amount, :purchase_time def initialize(sale_hash) @sale_id = sale_hash[:id].to_i @amount = sale_hash[:amount].to_i - @purchase_time = sale_hash[:purchase_time] ### NEEDS TO BE DATETIME + @purchase_time = DateTime.parse(sale_hash[:purchase_time]) + #@purchase_time = sale_hash[:purchase_time] ### NEEDS TO BE DATETIME @vendor_id = sale_hash[:vendor_id].to_i @product_id = sale_hash[:product_id].to_i end @@ -42,7 +43,17 @@ def product # Returns a collection of FarMar::Sale objects where the purchase time is between the two given times def self.between(beginning_time, end_time) + all_sales = FarMar::Sale.all + sales_between = [] + all_sales.find_all do |sale| + if sale.purchase_time > beginning_time || sale.purchase_time < end_time + sales_between.push(sale) + end + end + sales_between.sort_by! { |sale| sale.purchase_time } + return sales_between end + end end diff --git a/spec/far_mar/sale_spec.rb b/spec/far_mar/sale_spec.rb index 24cf5b26..be0a6d72 100644 --- a/spec/far_mar/sale_spec.rb +++ b/spec/far_mar/sale_spec.rb @@ -7,7 +7,7 @@ describe "#new" do it "create a new instance of Sale" do - example_sale_hash = {:id => 1111, :amount => 5678, :purchase_time => "a date", :vendor_id => 1, :product_id => 3} # NEED TO BUILD THE HASH + example_sale_hash = {:id => 1111, :amount => 5678, :purchase_time => "2010-03-21 07:17:17 -0800", :vendor_id => 1, :product_id => 3} # NEED TO BUILD THE HASH example_sale = FarMar::Sale.new(example_sale_hash) expect(example_sale).to be_an_instance_of FarMar::Sale end @@ -52,4 +52,22 @@ end end +describe '.between' do + before :each do + @start_date = DateTime.parse("2013-11-06 08:00:00 -0800") + @end_date = DateTime.parse("2013-11-06 09:00:00 -0800") + end + it "returns a non-empty array of sale objects" do + expect(FarMar::Sale.between( @start_date , @end_date )).to be_an_instance_of Array + expect(FarMar::Sale.between( @start_date , @end_date )).not_to eq [] + expect(FarMar::Sale.between( @start_date , @end_date )[0]).to be_an_instance_of FarMar::Sale + end + + it "returns the expected sale objects" do + expect(FarMar::Sale.between( @start_date , @end_date )[1].sale_id).to eq 1931 + end + + +end + end From 4f8fabb3c3e52c6160759ec4848d7a2df1aab571 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 14:19:05 -0700 Subject: [PATCH 16/35] Fixed the between method for Sale class --- lib/far_mar/market.rb | 2 +- lib/far_mar/sale.rb | 2 +- spec/far_mar/sale_spec.rb | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 14502c3f..228797e8 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -1,7 +1,7 @@ module FarMar class Market - attr_accessor :id, :name, :address, :city, :county, :state, :zip, :markets + attr_accessor :id, :name, :markets def initialize(market_hash) @id = market_hash[:id].to_i @name = market_hash[:name] diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index e6d5d844..e9aea2b0 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -46,7 +46,7 @@ def self.between(beginning_time, end_time) all_sales = FarMar::Sale.all sales_between = [] all_sales.find_all do |sale| - if sale.purchase_time > beginning_time || sale.purchase_time < end_time + if sale.purchase_time > beginning_time && sale.purchase_time < end_time sales_between.push(sale) end end diff --git a/spec/far_mar/sale_spec.rb b/spec/far_mar/sale_spec.rb index be0a6d72..793ce2ae 100644 --- a/spec/far_mar/sale_spec.rb +++ b/spec/far_mar/sale_spec.rb @@ -55,16 +55,17 @@ describe '.between' do before :each do @start_date = DateTime.parse("2013-11-06 08:00:00 -0800") - @end_date = DateTime.parse("2013-11-06 09:00:00 -0800") + @end_date = DateTime.parse("2013-11-07 00:00:00 -0800") end it "returns a non-empty array of sale objects" do - expect(FarMar::Sale.between( @start_date , @end_date )).to be_an_instance_of Array - expect(FarMar::Sale.between( @start_date , @end_date )).not_to eq [] - expect(FarMar::Sale.between( @start_date , @end_date )[0]).to be_an_instance_of FarMar::Sale + expect(FarMar::Sale.between(@start_date , @end_date)).to be_an_instance_of Array + expect(FarMar::Sale.between(@start_date , @end_date)).not_to eq [] + expect(FarMar::Sale.between(@start_date , @end_date)[0]).to be_an_instance_of FarMar::Sale end it "returns the expected sale objects" do - expect(FarMar::Sale.between( @start_date , @end_date )[1].sale_id).to eq 1931 + expect(FarMar::Sale.between(@start_date , @end_date)[1].sale_id).to eq 1931 + expect(FarMar::Sale.between(@start_date, @end_date).length).to eq 1113 end From cfd85cee8db13cef5644885f5c486880e43f85e5 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 14:46:54 -0700 Subject: [PATCH 17/35] Rewrote all self.all methods to use class variables, significantly reduces test time --- lib/far_mar/market.rb | 22 +++++++++++----------- lib/far_mar/product.rb | 22 +++++++++++----------- lib/far_mar/sale.rb | 20 +++++++++++--------- lib/far_mar/vendor.rb | 18 ++++++++++-------- 4 files changed, 43 insertions(+), 39 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 228797e8..014d19f6 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -1,7 +1,6 @@ module FarMar class Market - - attr_accessor :id, :name, :markets + attr_accessor :id, :name, :markets_all def initialize(market_hash) @id = market_hash[:id].to_i @name = market_hash[:name] @@ -13,16 +12,17 @@ def initialize(market_hash) end def self.all - @markets = [] - markets_csv = CSV.read("support/markets.csv") - - markets_csv.each do |id, name, address, city, county, state, zip| - hash = {:id => id, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} - market = FarMar::Market.new(hash) - @markets.push(market) - + @@markets_all ||= [] + if @@markets_all == [] + #binding.pry + markets_csv = CSV.read("support/markets.csv") + markets_csv.each do |id, name, address, city, county, state, zip| + hash = {:id => id, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} + market = FarMar::Market.new(hash) + @@markets_all.push(market) + end end - return @markets + return @markets = @@markets_all end def self.find(id) diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index 3b183104..caf9a2dc 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -10,22 +10,22 @@ def initialize(product_hash) # Return a collection of all Product instances, representing all the products described in the CSV def self.all - @products = [] - products_csv = CSV.read("support/products.csv") - - products_csv.each do |id, name, vendor_id| - hash = {:id => id, :name => name, :vendor_id => vendor_id} - product = FarMar::Product.new(hash) - @products.push(product) + @@products ||= [] + if @@products == [] + products_csv = CSV.read("support/products.csv") + + products_csv.each do |id, name, vendor_id| + hash = {:id => id, :name => name, :vendor_id => vendor_id} + product = FarMar::Product.new(hash) + @@products.push(product) + end end - return @products + return @@products end # Returns an instance of Product with the passed in ID def self.find(id) - @products.find do |product| - product.product_id == id - end + @@products.find { |product| product.product_id == id } end # Returns the FarMar::Vendor instance that is associated with the product diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index e9aea2b0..d971c2eb 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -13,20 +13,22 @@ def initialize(sale_hash) # Returns a collection of Sale instances, representing all of the sales described in the CSV def self.all - @sales = [] - sales_csv = CSV.read("support/sales.csv") - - sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| - hash = {:id => id, :amount => amount, :purchase_time => purchase_time, :vendor_id => vendor_id, :product_id => product_id} - sale = FarMar::Sale.new(hash) - @sales.push(sale) + @@sales ||= [] + if @@sales == [] + sales_csv = CSV.read("support/sales.csv") + + sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| + hash = {:id => id, :amount => amount, :purchase_time => purchase_time, :vendor_id => vendor_id, :product_id => product_id} + sale = FarMar::Sale.new(hash) + @@sales.push(sale) + end end - return @sales + return @@sales end # Returns an instance of Sale where the value of the ID field matches the passed parameter def self.find(id) - @sales.find do |sale| + @@sales.find do |sale| sale.sale_id == id end end diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index a9148416..92793792 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -11,20 +11,22 @@ def initialize(vendor_hash) # Returns a collection of Vendor instances, representing all the vendors described in the CSV def self.all - @vendors = [] - vendors_csv = CSV.read("support/vendors.csv") + @@vendors ||= [] + if @@vendors == [] + vendors_csv = CSV.read("support/vendors.csv") - vendors_csv.each do |id, name, num_employees, market_id| - hash = {:id => id, :name => name, :employees => num_employees, :market_id => market_id} - vendor = FarMar::Vendor.new(hash) - @vendors.push(vendor) + vendors_csv.each do |id, name, num_employees, market_id| + hash = {:id => id, :name => name, :employees => num_employees, :market_id => market_id} + vendor = FarMar::Vendor.new(hash) + @@vendors.push(vendor) + end end - return @vendors + return @@vendors end # Returns an instance of Vendor that matches the search ID def self.find(id) - @vendors.find do |vendor| + @@vendors.find do |vendor| vendor.vendor_id == id end end From 721bed5e08d28e446c9ab265f93cbb54e93f8729 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 14:50:38 -0700 Subject: [PATCH 18/35] Removed class variables and went with instance variables instead --- lib/far_mar/market.rb | 8 ++++---- lib/far_mar/product.rb | 10 +++++----- lib/far_mar/sale.rb | 10 +++++----- lib/far_mar/vendor.rb | 11 ++++++----- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 014d19f6..cfd3655a 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -12,17 +12,17 @@ def initialize(market_hash) end def self.all - @@markets_all ||= [] - if @@markets_all == [] + @markets_all ||= [] + if @markets_all == [] #binding.pry markets_csv = CSV.read("support/markets.csv") markets_csv.each do |id, name, address, city, county, state, zip| hash = {:id => id, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} market = FarMar::Market.new(hash) - @@markets_all.push(market) + @markets_all.push(market) end end - return @markets = @@markets_all + return @markets = @markets_all end def self.find(id) diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index caf9a2dc..93d7f770 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -10,22 +10,22 @@ def initialize(product_hash) # Return a collection of all Product instances, representing all the products described in the CSV def self.all - @@products ||= [] - if @@products == [] + @products ||= [] + if @products == [] products_csv = CSV.read("support/products.csv") products_csv.each do |id, name, vendor_id| hash = {:id => id, :name => name, :vendor_id => vendor_id} product = FarMar::Product.new(hash) - @@products.push(product) + @products.push(product) end end - return @@products + return @products end # Returns an instance of Product with the passed in ID def self.find(id) - @@products.find { |product| product.product_id == id } + @products.find { |product| product.product_id == id } end # Returns the FarMar::Vendor instance that is associated with the product diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index d971c2eb..cfef4d89 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -13,22 +13,22 @@ def initialize(sale_hash) # Returns a collection of Sale instances, representing all of the sales described in the CSV def self.all - @@sales ||= [] - if @@sales == [] + @sales ||= [] + if @sales == [] sales_csv = CSV.read("support/sales.csv") sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| hash = {:id => id, :amount => amount, :purchase_time => purchase_time, :vendor_id => vendor_id, :product_id => product_id} sale = FarMar::Sale.new(hash) - @@sales.push(sale) + @sales.push(sale) end end - return @@sales + return @sales end # Returns an instance of Sale where the value of the ID field matches the passed parameter def self.find(id) - @@sales.find do |sale| + @sales.find do |sale| sale.sale_id == id end end diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 92793792..2f5938f1 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -11,22 +11,23 @@ def initialize(vendor_hash) # Returns a collection of Vendor instances, representing all the vendors described in the CSV def self.all - @@vendors ||= [] - if @@vendors == [] + # Using a class variable for the + @vendors ||= [] + if @vendors == [] vendors_csv = CSV.read("support/vendors.csv") vendors_csv.each do |id, name, num_employees, market_id| hash = {:id => id, :name => name, :employees => num_employees, :market_id => market_id} vendor = FarMar::Vendor.new(hash) - @@vendors.push(vendor) + @vendors.push(vendor) end end - return @@vendors + return @vendors end # Returns an instance of Vendor that matches the search ID def self.find(id) - @@vendors.find do |vendor| + @vendors.find do |vendor| vendor.vendor_id == id end end From 3a84755d89153f1bf0d2f326470a991f2f5430c8 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 14:53:51 -0700 Subject: [PATCH 19/35] Updated to-do list --- To-Do.txt | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/To-Do.txt b/To-Do.txt index 55a11789..69a80487 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -1,21 +1,4 @@ -# Need to check data types for CSV input in Market -# Need to check data types for CSV input in product -# Need to deal with Date Time for CSV input in Sale -# Check accessors + # Improve #vendors spec - suspect this could be written more efficiently -# Write the product method for vendor # Rewrite the vendor by_market spec - using length but should be testing result accuracy # Rewrite tests to take test data -# Hailey's efficiency code: - def self.all - @@markets_all ||= [] - if @@markets_all == [] - CSV.read("support/markets.csv").each do |id, name, address, city, county, state, zip| - #binding.pry - market_hash = {:id => id.to_i, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} - market = FarMar::Market.new(market_hash) - @@markets_all.push(market) - end - end - return @@markets_all - end From 78808a40284ebc3135d77bba1062a2d739699e97 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 14:54:15 -0700 Subject: [PATCH 20/35] Comments to Market,Product,Sale, Vendor classes --- lib/far_mar/market.rb | 9 +++++---- lib/far_mar/product.rb | 1 + lib/far_mar/sale.rb | 1 + lib/far_mar/vendor.rb | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index cfd3655a..046b7d2d 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -12,17 +12,18 @@ def initialize(market_hash) end def self.all - @markets_all ||= [] - if @markets_all == [] + # Only reload the CSV if @markets is empty array + @markets ||= [] + if @markets == [] #binding.pry markets_csv = CSV.read("support/markets.csv") markets_csv.each do |id, name, address, city, county, state, zip| hash = {:id => id, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} market = FarMar::Market.new(hash) - @markets_all.push(market) + @markets.push(market) end end - return @markets = @markets_all + return @markets end def self.find(id) diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index 93d7f770..1e5a3c0a 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -10,6 +10,7 @@ def initialize(product_hash) # Return a collection of all Product instances, representing all the products described in the CSV def self.all + # Only reload the CSV if @products is empty array @products ||= [] if @products == [] products_csv = CSV.read("support/products.csv") diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index cfef4d89..07a4c85a 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -13,6 +13,7 @@ def initialize(sale_hash) # Returns a collection of Sale instances, representing all of the sales described in the CSV def self.all + # Only reload the CSV is sales is empty array @sales ||= [] if @sales == [] sales_csv = CSV.read("support/sales.csv") diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 2f5938f1..5a828e2a 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -11,7 +11,7 @@ def initialize(vendor_hash) # Returns a collection of Vendor instances, representing all the vendors described in the CSV def self.all - # Using a class variable for the + # Only reload the CSV if @vendors is empty array @vendors ||= [] if @vendors == [] vendors_csv = CSV.read("support/vendors.csv") From a6afe394cfce775bb9d5d36221a80a41b00a5cab Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 15:01:37 -0700 Subject: [PATCH 21/35] Added the class variables back in. Oops. --- lib/far_mar/market.rb | 10 +++++----- lib/far_mar/product.rb | 10 +++++----- lib/far_mar/sale.rb | 10 +++++----- lib/far_mar/vendor.rb | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 046b7d2d..64ecdc80 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -13,21 +13,21 @@ def initialize(market_hash) def self.all # Only reload the CSV if @markets is empty array - @markets ||= [] - if @markets == [] + @@markets ||= [] + if @@markets == [] #binding.pry markets_csv = CSV.read("support/markets.csv") markets_csv.each do |id, name, address, city, county, state, zip| hash = {:id => id, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} market = FarMar::Market.new(hash) - @markets.push(market) + @@markets.push(market) end end - return @markets + return @@markets end def self.find(id) - @markets.find do |market| + @@markets.find do |market| market.id == id end end diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index 1e5a3c0a..b41c1d35 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -11,22 +11,22 @@ def initialize(product_hash) # Return a collection of all Product instances, representing all the products described in the CSV def self.all # Only reload the CSV if @products is empty array - @products ||= [] - if @products == [] + @@products ||= [] + if @@products == [] products_csv = CSV.read("support/products.csv") products_csv.each do |id, name, vendor_id| hash = {:id => id, :name => name, :vendor_id => vendor_id} product = FarMar::Product.new(hash) - @products.push(product) + @@products.push(product) end end - return @products + return @@products end # Returns an instance of Product with the passed in ID def self.find(id) - @products.find { |product| product.product_id == id } + @@products.find { |product| product.product_id == id } end # Returns the FarMar::Vendor instance that is associated with the product diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index 07a4c85a..5dcb8a06 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -14,22 +14,22 @@ def initialize(sale_hash) # Returns a collection of Sale instances, representing all of the sales described in the CSV def self.all # Only reload the CSV is sales is empty array - @sales ||= [] - if @sales == [] + @@sales ||= [] + if @@sales == [] sales_csv = CSV.read("support/sales.csv") sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| hash = {:id => id, :amount => amount, :purchase_time => purchase_time, :vendor_id => vendor_id, :product_id => product_id} sale = FarMar::Sale.new(hash) - @sales.push(sale) + @@sales.push(sale) end end - return @sales + return @@sales end # Returns an instance of Sale where the value of the ID field matches the passed parameter def self.find(id) - @sales.find do |sale| + @@sales.find do |sale| sale.sale_id == id end end diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 5a828e2a..41b89e6b 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -12,22 +12,22 @@ def initialize(vendor_hash) # Returns a collection of Vendor instances, representing all the vendors described in the CSV def self.all # Only reload the CSV if @vendors is empty array - @vendors ||= [] - if @vendors == [] + @@vendors ||= [] + if @@vendors == [] vendors_csv = CSV.read("support/vendors.csv") vendors_csv.each do |id, name, num_employees, market_id| hash = {:id => id, :name => name, :employees => num_employees, :market_id => market_id} vendor = FarMar::Vendor.new(hash) - @vendors.push(vendor) + @@vendors.push(vendor) end end - return @vendors + return @@vendors end # Returns an instance of Vendor that matches the search ID def self.find(id) - @vendors.find do |vendor| + @@vendors.find do |vendor| vendor.vendor_id == id end end From 748afd3755f7393676063e14cbf5d23e89d52f09 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 15:37:47 -0700 Subject: [PATCH 22/35] Added products method to Market class --- lib/far_mar/market.rb | 33 +++++++++++++++++++++++++++++++++ spec/far_mar/market_spec.rb | 10 ++++++++++ 2 files changed, 43 insertions(+) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 64ecdc80..eaa03155 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -39,5 +39,38 @@ def vendors end return matched_vendors end + + # ----------- OPTIONAL REQUIREMENTS: Part I --------------------- # + + # Returns a collection of product instances that are associated to the market though the FarMar::Vendor class + def products + products = [] + matched_vendors = self.vendors + matched_vendors.each { |vendor| products.push(vendor.products)} + products.flatten! + return products + end + + # Returns a collection of Market instances where the market name or vendor name contain the search term + def self.search(search_term) + end + + # Returns the vendor with the highest revenue + def preferred_vendor + end + + # Returns the vendor with highest revenue for the given date + def preferred_vendor(date) + end + + # Returns the vendor with the lowest revenue + def worst_vendor + end + + # Returns the vendor with the lowest revenue for the given date + def worst_vendor(date) + end + + end end diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index 09445bea..d27b4b2a 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -45,4 +45,14 @@ expect(sample_market.vendors.length).to eq matched_vendors.length end end + + describe "#products" do + it "returns an array with products in it" do + sample_market = @markets[1] + expect(sample_market.products).to be_an_instance_of Array + expect(sample_market.products).not_to eq [] + expect(sample_market.products.length).to eq 9 + expect(sample_market.products[0].product_name).to eq "Stupendous Carrots" + end + end end From 839ede64dc65c55b049e820329a957b28e3ce509 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 15:53:31 -0700 Subject: [PATCH 23/35] Added the preferred vendor method to Market class --- lib/far_mar/market.rb | 10 ++++++++-- spec/far_mar/market_spec.rb | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index eaa03155..baafe8fa 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -53,15 +53,21 @@ def products # Returns a collection of Market instances where the market name or vendor name contain the search term def self.search(search_term) + #FarMar::Market.all + #FarMar::Vendor.all + # WORK IN PROGRESS end # Returns the vendor with the highest revenue def preferred_vendor + all_vendors = self.vendors + all_vendors.sort_by! { |vendor| vendor.revenue} + return all_vendors[-1] end # Returns the vendor with highest revenue for the given date - def preferred_vendor(date) - end + # def preferred_vendor(date) + # end # Returns the vendor with the lowest revenue def worst_vendor diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index d27b4b2a..c4cff5e3 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -51,8 +51,26 @@ sample_market = @markets[1] expect(sample_market.products).to be_an_instance_of Array expect(sample_market.products).not_to eq [] + end + + it "returns the correct products for a given market" do + sample_market = @markets[1] expect(sample_market.products.length).to eq 9 expect(sample_market.products[0].product_name).to eq "Stupendous Carrots" end end + + describe "#preferred_vendor" do + it "returns a vendor object" do + sample_market = @markets[1] + expect(sample_market.preferred_vendor).to be_an_instance_of FarMar::Vendor + end + it "returns the vendor object with the highest revenue" do + sample_market = @markets[1] + all_vendors = sample_market.vendors + max = all_vendors.max_by { |i| i.revenue} + expect(sample_market.preferred_vendor).to eq max + end + + end end From 6f00dd87604679928d1f3979b843d5b41a0ebed9 Mon Sep 17 00:00:00 2001 From: noglows Date: Wed, 21 Oct 2015 16:04:48 -0700 Subject: [PATCH 24/35] Added worst_vendor method to Market class --- lib/far_mar/market.rb | 31 ++++++++++++++++++------------- spec/far_mar/market_spec.rb | 16 ++++++++++++++++ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index baafe8fa..719c100d 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -59,22 +59,27 @@ def self.search(search_term) end # Returns the vendor with the highest revenue - def preferred_vendor - all_vendors = self.vendors - all_vendors.sort_by! { |vendor| vendor.revenue} - return all_vendors[-1] + # Can take a date as an input to return the vendor with the highest revenue on a given date + def preferred_vendor(date = nil) + if date == nil + all_vendors = self.vendors + all_vendors.sort_by! { |vendor| vendor.revenue } + return all_vendors[-1] + else + ## ACCOMODATE TAKING A DATE AS INPUT HERE + end end - # Returns the vendor with highest revenue for the given date - # def preferred_vendor(date) - # end - # Returns the vendor with the lowest revenue - def worst_vendor - end - - # Returns the vendor with the lowest revenue for the given date - def worst_vendor(date) + # Can take a date as an input to return the vendor with the lowest revenue on a given date + def worst_vendor(date = nil) + if date == nil + all_vendors = self.vendors + all_vendors.sort_by! { |vendor| vendor.revenue } + return all_vendors[0] + else + ## ACCOMODATE TAKING A DATE AS INPUT HERE + end end diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index c4cff5e3..3b196024 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -73,4 +73,20 @@ end end + + describe "#worst_vendor" do + it "returns a vendor object" do + sample_market = @markets[1] + expect(sample_market.worst_vendor).to be_an_instance_of FarMar::Vendor + end + + it "returns the vendor object with the lowest revenue" do + sample_market = @markets[1] + all_vendors = sample_market.vendors + min = all_vendors.min_by { |i| i.revenue} + expect(sample_market.worst_vendor).to eq min + end + + end + end From 390d3e1b3824c9f29a0a6fd8eb4542f0407319f3 Mon Sep 17 00:00:00 2001 From: noglows Date: Thu, 22 Oct 2015 11:08:51 -0700 Subject: [PATCH 25/35] Setting up test data files --- test_data/test_markets.csv | 10 ++ test_data/test_products.csv | 159 ++++++++++++++++++++++++ test_data/test_sales.csv | 240 ++++++++++++++++++++++++++++++++++++ test_data/test_vendors.csv | 48 ++++++++ 4 files changed, 457 insertions(+) create mode 100644 test_data/test_markets.csv create mode 100644 test_data/test_products.csv create mode 100644 test_data/test_sales.csv create mode 100644 test_data/test_vendors.csv diff --git a/test_data/test_markets.csv b/test_data/test_markets.csv new file mode 100644 index 00000000..15afabc6 --- /dev/null +++ b/test_data/test_markets.csv @@ -0,0 +1,10 @@ +1,People's Co-op Farmers Market,30th and Burnside,Portland,Multnomah,Oregon,97202 +2,Silverdale Farmers Market,98383,Silverdale,Kitsap,Washington,98383 +3,Dolgeville Farmer's Market,(Parking Lot) Between Main St. and Helmer Ave,Dolgeville,Herkimer,New York,13329 +4,Preston Farmers’ Market,#1 Route 164,Preston,New London,Connecticut, +5,Quincy Farmers Market,0 Denis Ryan Parkway,Quincy,Norfolk,Massachusetts,2169 +6,Jefferson City Farmer's Market,000 Main Street,Jefferson City,Cole,Missouri,0 +7,Petaluma Evening Farmers' Market,1 2nd Street,Petaluma,Sonoma,California,94952 +8,Charlestown Farmers Market,"1 Austin Street, Thompson Square at Austin & Main Streets",Boston,,Massachusetts,2129 +9,Farmers Market at Christopher Newport University,1 Avenue of the Arts,Newport News,Newport News,Virginia,23606 +10,Saratoga Farmers' Market,1 Bayberry Drive,Ballston Sp,Saratoga,New York,12020 diff --git a/test_data/test_products.csv b/test_data/test_products.csv new file mode 100644 index 00000000..9d56c0f2 --- /dev/null +++ b/test_data/test_products.csv @@ -0,0 +1,159 @@ +1,Dry Beets,1 +2,Fierce Greens,2 +3,Heavy Chicken,2 +4,Yummy Fruit,3 +5,Green Apples,4 +6,Smooth Mushrooms,4 +7,Quaint Beef,4 +8,Shaky Honey,5 +9,Large Mushrooms,5 +10,Black Apples,5 +11,Gigantic Bread,6 +12,Gorgeous Fish,6 +13,Curved Pretzel,6 +14,Stupendous Carrots,7 +15,Comfortable Pretzel,8 +16,Obedient Fish,8 +17,Defeated Apples,8 +18,Yellow Bread,8 +19,Jealous Burrito,9 +20,Tall Pretzel,9 +21,Embarrassed Bread,9 +22,Purring Beets,9 +23,Calm Carrots,10 +24,Fierce Beef,10 +25,Helpless Bread,10 +26,Yummy Bread,10 +27,Broken Beets,10 +28,Quiet Honey,11 +29,Crazy Fish,11 +30,Depressed Beets,11 +31,Sore Chicken,11 +32,Disgusted Carrots,11 +33,Tired Bread,12 +34,Clumsy Chicken,12 +35,Massive Apples,12 +36,Mute Beef,13 +37,Grand Honey,13 +38,Bland Burrito,13 +39,Horrible Burrito,14 +40,Bad Chicken,14 +41,Thundering Carrots,15 +42,Grubby Beef,15 +43,Skinny Mushrooms,15 +44,Repulsive Chicken,15 +45,Bland Chicken,16 +46,Miniature Fish,16 +47,Delicious Carrots,16 +48,Robust Burrito,16 +49,M Greens,16 +50,Quaint Bread,17 +51,Successful Apples,18 +52,Sticky Fish,18 +53,– Bread,18 +54,Miniature Beets,18 +55,Delightful Chicken,19 +56,Nom nom Beef,19 +57,Anxious Carrots,19 +58,Thoughtless Honey,20 +59,Cheerful Fish,21 +60,Colossal Beets,21 +61,Amused Apples,21 +62,Righteous Fish,21 +63,Rainy Bread,21 +64,Fresh Apples,22 +65,Worried Pretzel,22 +66,Homeless Honey,22 +67,Loose Fish,22 +68,Better Apples,23 +69,Swift Pretzel,23 +70,Annoyed Fish,23 +71,Mighty Beef,23 +72,Ordinary Honey,23 +73,Jolly Greens,24 +74,Amused Beets,25 +75,Obnoxious Fruit,26 +76,Tough Beets,26 +77,Harsh Greens,26 +78,High Mushrooms,27 +79,Weak Fish,27 +80,Steep Beets,27 +81,Worried Pretzel,27 +82,Dangerous Mushrooms,27 +83,Silly Beef,28 +84,Hushed Honey,28 +85,Agreeable Honey,28 +86,Incredible Burrito,29 +87,Combative Bread,29 +88,Clumsy Chicken,29 +89,Pickled Mushrooms,30 +90,Tense Greens,30 +91,Spicy Mushrooms,30 +92,Frightened Honey,31 +93,Upset Honey,31 +94,Quaint Greens,31 +95,Dirty Mushrooms,31 +96,Harsh Carrots,31 +97,Jolly Beef,32 +98,Watery Pretzel,32 +99,Hot Beef,32 +100,Blue Chicken,32 +101,Mute Chicken,33 +102,Rainy Fish,33 +103,Short Greens,33 +104,Nutty Pretzel,34 +105,Happy Mushrooms,34 +106,Tan Fruit,34 +107,Colossal Greens,34 +108,Perfect Apples,34 +109,Late Mushrooms,35 +110,Smiling Beef,35 +111,Spotty Chicken,35 +112,Jolly Beef,35 +113,Tall Carrots,36 +114,Short Beets,36 +115,Stupendous Greens,36 +116,Better Beef,36 +117,Jolly Apples,36 +118,Dry Beef,37 +119,Rotten Bread,38 +120,Heavy Fruit,38 +121,Immense Honey,38 +122,Lazy Greens,38 +123,Kickin' Pretzel,38 +124,Silly Greens,39 +125,Panicky Bread,39 +126,Jittery Mushrooms,39 +127,Helpful Fish,40 +128,Nice Mushrooms,40 +129,Friendly Burrito,40 +130,Bitter Pretzel,40 +131,Tasteless Greens,40 +132,Sharp Chicken,41 +133,– Fish,41 +134,High Fish,41 +135,Bland Apples,41 +136,Pretty Fruit,42 +137,Great Bread,42 +138,Tough Beets,42 +139,Fluffy Beef,42 +140,Splendid Honey,42 +141,Hurt Honey,43 +142,Precious Fish,43 +143,Striped Beef,43 +144,Husky Beets,43 +145,Pretty Beets,44 +146,Watery Fish,44 +147,Robust Beef,45 +148,Helpless Beets,45 +149,Heavy Honey,45 +150,Rotten Bread,45 +151,Exuberant Mushrooms,45 +152,Many Beef,46 +153,Elated Pretzel,46 +154,Grubby Beets,46 +155,Frightened Beets,46 +156,Faithful Fruit,47 +157,Square Honey,47 +158,Grumpy Fruit,48 +159,Tight Bread,48 diff --git a/test_data/test_sales.csv b/test_data/test_sales.csv new file mode 100644 index 00000000..b942d4cc --- /dev/null +++ b/test_data/test_sales.csv @@ -0,0 +1,240 @@ +1,9290,2013-11-07 04:34:56 -0800,1,1 +2,2262,2013-11-10 02:44:56 -0800,1,1 +3,9588,2013-11-13 01:49:37 -0800,1,1 +4,1634,2013-11-06 20:44:00 -0800,1,1 +5,4440,2013-11-10 05:19:05 -0800,1,1 +6,6950,2013-11-11 11:29:52 -0800,1,1 +7,4095,2013-11-12 14:38:29 -0800,1,1 +8,5727,2013-11-12 06:03:54 -0800,2,2 +9,9128,2013-11-13 01:48:15 -0800,3,4 +10,5160,2013-11-08 04:31:41 -0800,3,4 +11,1030,2013-11-10 18:56:53 -0800,3,4 +12,5179,2013-11-08 16:36:03 -0800,3,4 +13,3450,2013-11-12 12:00:35 -0800,3,4 +14,4978,2013-11-10 01:51:24 -0800,3,4 +15,8924,2013-11-10 11:31:16 -0800,3,4 +16,2277,2013-11-09 01:16:47 -0800,3,4 +17,3442,2013-11-10 04:16:12 -0800,4,7 +18,5375,2013-11-08 12:21:41 -0800,4,5 +19,9035,2013-11-11 03:37:15 -0800,4,6 +20,51,2013-11-10 09:48:05 -0800,4,5 +21,8963,2013-11-10 12:26:30 -0800,4,7 +22,7180,2013-11-12 06:40:46 -0800,5,9 +23,8382,2013-11-09 08:13:09 -0800,5,8 +24,3776,2013-11-08 16:12:20 -0800,5,8 +25,4951,2013-11-09 23:42:41 -0800,5,9 +26,9690,2013-11-09 21:45:12 -0800,5,9 +27,2851,2013-11-13 04:14:40 -0800,5,10 +28,9015,2013-11-06 14:19:49 -0800,5,8 +29,8445,2013-11-11 06:44:12 -0800,5,8 +30,7459,2013-11-10 01:44:14 -0800,5,8 +31,2977,2013-11-09 10:57:21 -0800,6,13 +32,1980,2013-11-12 03:41:53 -0800,7,14 +33,8559,2013-11-11 06:26:33 -0800,7,14 +34,6027,2013-11-07 13:01:30 -0800,7,14 +35,8375,2013-11-10 17:04:00 -0800,7,14 +36,6433,2013-11-11 15:39:50 -0800,7,14 +37,6350,2013-11-07 20:25:38 -0800,7,14 +38,1995,2013-11-11 16:20:22 -0800,7,14 +39,9348,2013-11-08 10:38:56 -0800,8,17 +40,5432,2013-11-12 01:22:56 -0800,8,15 +41,4263,2013-11-08 16:36:05 -0800,8,16 +42,3043,2013-11-07 12:01:03 -0800,8,17 +43,8222,2013-11-13 05:56:55 -0800,8,17 +44,1458,2013-11-10 01:42:35 -0800,8,17 +45,7011,2013-11-07 20:57:31 -0800,8,18 +46,9111,2013-11-08 16:05:24 -0800,8,18 +47,8150,2013-11-08 00:40:59 -0800,8,15 +48,2510,2013-11-10 00:43:31 -0800,9,21 +49,3697,2013-11-11 18:43:56 -0800,9,20 +50,5420,2013-11-07 19:30:03 -0800,9,19 +51,9341,2013-11-09 10:18:19 -0800,9,21 +52,3461,2013-11-13 05:05:00 -0800,9,22 +53,844,2013-11-08 21:50:58 -0800,10,27 +54,1410,2013-11-12 23:13:10 -0800,10,27 +55,9333,2013-11-09 15:44:59 -0800,10,25 +56,2731,2013-11-10 01:37:13 -0800,10,25 +57,5017,2013-11-12 19:57:23 -0800,10,27 +58,4111,2013-11-11 00:27:44 -0800,10,26 +59,3233,2013-11-08 11:50:45 -0800,10,23 +60,5949,2013-11-11 02:43:04 -0800,10,23 +61,626,2013-11-07 15:47:38 -0800,11,28 +62,8296,2013-11-07 00:31:35 -0800,11,32 +63,4522,2013-11-08 23:23:56 -0800,11,28 +64,8362,2013-11-07 05:30:08 -0800,11,30 +65,9460,2013-11-13 00:58:12 -0800,11,32 +66,9711,2013-11-11 15:36:04 -0800,12,35 +67,963,2013-11-08 15:12:25 -0800,12,33 +68,295,2013-11-10 01:21:48 -0800,12,33 +69,10,2013-11-10 00:03:56 -0800,13,38 +70,2838,2013-11-09 13:30:15 -0800,13,38 +71,564,2013-11-08 18:43:45 -0800,14,40 +72,593,2013-11-08 04:55:34 -0800,14,40 +73,4154,2013-11-08 18:31:12 -0800,14,40 +74,6070,2013-11-10 19:58:53 -0800,15,41 +75,7256,2013-11-07 11:12:18 -0800,15,41 +76,6071,2013-11-08 11:28:57 -0800,15,41 +77,5365,2013-11-09 07:35:23 -0800,15,41 +78,886,2013-11-08 23:59:36 -0800,15,44 +79,9682,2013-11-13 07:13:19 -0800,15,41 +80,8084,2013-11-09 06:20:31 -0800,15,44 +81,4991,2013-11-08 20:28:54 -0800,16,47 +82,6867,2013-11-07 07:58:18 -0800,16,48 +83,8415,2013-11-06 11:29:41 -0800,16,47 +84,8790,2013-11-08 02:15:19 -0800,16,46 +85,2832,2013-11-10 00:44:12 -0800,16,48 +86,7454,2013-11-11 07:56:35 -0800,16,48 +87,2497,2013-11-11 04:54:54 -0800,16,45 +88,9679,2013-11-09 14:17:35 -0800,17,50 +89,3313,2013-11-12 13:20:28 -0800,17,50 +90,1793,2013-11-10 10:11:20 -0800,17,50 +91,6010,2013-11-10 01:42:37 -0800,17,50 +92,434,2013-11-11 00:18:23 -0800,17,50 +93,3654,2013-11-11 09:42:24 -0800,17,50 +94,4170,2013-11-11 03:55:44 -0800,18,52 +95,5579,2013-11-06 10:07:58 -0800,18,51 +96,2289,2013-11-10 17:23:48 -0800,19,57 +97,8743,2013-11-08 04:24:05 -0800,19,56 +98,3187,2013-11-10 17:03:33 -0800,19,57 +99,6930,2013-11-10 13:23:07 -0800,19,55 +100,4573,2013-11-08 15:18:32 -0800,19,56 +101,6539,2013-11-12 06:44:41 -0800,20,58 +102,6390,2013-11-11 02:06:01 -0800,20,58 +103,3310,2013-11-09 10:25:22 -0800,20,58 +104,5690,2013-11-11 06:23:19 -0800,20,58 +105,8672,2013-11-08 12:28:53 -0800,20,58 +106,7028,2013-11-07 22:40:04 -0800,21,60 +107,3779,2013-11-08 05:40:53 -0800,21,60 +108,822,2013-11-11 01:44:44 -0800,21,63 +109,1826,2013-11-10 02:53:07 -0800,21,59 +110,3751,2013-11-07 21:31:14 -0800,21,62 +111,5889,2013-11-09 20:25:45 -0800,21,62 +112,7797,2013-11-11 13:48:16 -0800,22,64 +113,4564,2013-11-06 18:33:45 -0800,22,64 +114,4548,2013-11-08 01:47:50 -0800,22,65 +115,7870,2013-11-10 07:07:29 -0800,22,66 +116,6858,2013-11-09 06:00:22 -0800,22,67 +117,7912,2013-11-10 08:21:58 -0800,22,65 +118,785,2013-11-11 14:35:45 -0800,23,72 +119,1664,2013-11-12 15:45:49 -0800,23,69 +120,1810,2013-11-10 22:19:43 -0800,23,70 +121,4890,2013-11-09 22:01:19 -0800,23,70 +122,4847,2013-11-08 04:09:35 -0800,23,69 +123,4480,2013-11-12 10:13:45 -0800,24,73 +124,4636,2013-11-13 02:57:50 -0800,24,73 +125,3128,2013-11-08 06:34:47 -0800,25,74 +126,4221,2013-11-10 22:36:50 -0800,25,74 +127,5790,2013-11-08 06:20:42 -0800,25,74 +128,1143,2013-11-06 08:40:22 -0800,25,74 +129,1195,2013-11-10 10:40:40 -0800,25,74 +130,9173,2013-11-09 18:43:19 -0800,25,74 +131,4911,2013-11-12 05:43:19 -0800,25,74 +132,6509,2013-11-12 21:23:36 -0800,26,75 +133,1628,2013-11-12 18:37:47 -0800,26,77 +134,9088,2013-11-12 11:28:58 -0800,26,75 +135,1257,2013-11-07 21:05:27 -0800,26,76 +136,4694,2013-11-06 15:30:59 -0800,26,76 +137,4838,2013-11-12 09:10:10 -0800,26,75 +138,4112,2013-11-10 11:20:55 -0800,27,78 +139,294,2013-11-08 06:10:28 -0800,27,82 +140,2924,2013-11-09 22:17:00 -0800,27,80 +141,4589,2013-11-11 06:02:18 -0800,28,85 +142,3220,2013-11-08 01:28:06 -0800,29,87 +143,8521,2013-11-07 15:56:41 -0800,29,87 +144,9430,2013-11-10 03:24:10 -0800,29,88 +145,7916,2013-11-08 11:35:38 -0800,29,88 +146,4589,2013-11-08 12:53:02 -0800,29,87 +147,8111,2013-11-10 04:31:10 -0800,29,88 +148,7863,2013-11-13 04:29:57 -0800,29,86 +149,3091,2013-11-12 07:52:56 -0800,29,88 +150,717,2013-11-06 23:53:18 -0800,30,91 +151,5184,2013-11-07 12:32:39 -0800,30,89 +152,6377,2013-11-08 04:15:30 -0800,30,90 +153,3068,2013-11-08 12:03:41 -0800,30,89 +154,250,2013-11-12 14:25:06 -0800,30,89 +155,2515,2013-11-07 21:05:48 -0800,30,89 +156,6380,2013-11-12 19:11:50 -0800,30,91 +157,1159,2013-11-09 08:04:14 -0800,30,89 +158,5091,2013-11-11 01:40:51 -0800,31,94 +159,2264,2013-11-12 08:31:13 -0800,31,92 +160,2397,2013-11-09 23:32:57 -0800,31,92 +161,5435,2013-11-06 20:50:02 -0800,31,93 +162,3357,2013-11-09 05:29:45 -0800,32,97 +163,4371,2013-11-09 00:00:24 -0800,32,97 +164,3654,2013-11-08 01:40:32 -0800,33,103 +165,9646,2013-11-13 02:23:23 -0800,33,103 +166,4895,2013-11-09 14:56:25 -0800,33,102 +167,3590,2013-11-06 10:13:39 -0800,33,102 +168,4096,2013-11-07 03:33:58 -0800,33,101 +169,1814,2013-11-12 21:54:03 -0800,33,101 +170,2462,2013-11-13 07:03:27 -0800,33,101 +171,56,2013-11-11 20:40:32 -0800,33,103 +172,1710,2013-11-06 11:27:57 -0800,34,107 +173,4758,2013-11-09 21:51:17 -0800,34,107 +174,6619,2013-11-08 15:52:48 -0800,34,107 +175,5824,2013-11-07 21:51:51 -0800,34,105 +176,2091,2013-11-10 04:35:06 -0800,34,107 +177,2820,2013-11-09 16:45:19 -0800,34,106 +178,9558,2013-11-12 02:34:54 -0800,35,110 +179,2964,2013-11-12 00:39:14 -0800,35,111 +180,5870,2013-11-10 17:07:30 -0800,35,109 +181,9570,2013-11-06 19:04:38 -0800,35,111 +182,7443,2013-11-07 21:54:43 -0800,35,109 +183,6647,2013-11-08 09:51:36 -0800,35,112 +184,8787,2013-11-07 02:19:05 -0800,36,117 +185,1985,2013-11-13 07:49:09 -0800,37,118 +186,9242,2013-11-08 09:07:17 -0800,37,118 +187,821,2013-11-07 01:34:39 -0800,37,118 +188,44,2013-11-12 03:37:54 -0800,37,118 +189,7264,2013-11-11 08:53:44 -0800,38,122 +190,7070,2013-11-10 23:45:28 -0800,38,120 +191,2661,2013-11-09 07:22:39 -0800,38,123 +192,343,2013-11-11 17:16:11 -0800,38,119 +193,5893,2013-11-08 14:42:23 -0800,38,121 +194,8775,2013-11-07 04:14:21 -0800,38,121 +195,2259,2013-11-12 17:02:28 -0800,38,120 +196,8165,2013-11-12 04:22:55 -0800,38,120 +197,7878,2013-11-11 09:57:51 -0800,39,124 +198,9237,2013-11-07 08:17:20 -0800,39,126 +199,8435,2013-11-06 19:17:53 -0800,40,128 +200,8311,2013-11-12 03:21:43 -0800,40,128 +201,5438,2013-11-07 02:11:04 -0800,40,130 +202,4683,2013-11-08 20:18:25 -0800,40,131 +203,6675,2013-11-11 13:23:24 -0800,40,129 +204,2667,2013-11-12 01:29:25 -0800,40,127 +205,9298,2013-11-11 02:34:34 -0800,40,131 +206,6478,2013-11-08 05:16:16 -0800,40,131 +207,8142,2013-11-11 13:38:21 -0800,40,131 +208,3163,2013-11-09 15:14:14 -0800,41,135 +209,4710,2013-11-07 11:06:39 -0800,41,134 +210,3633,2013-11-10 16:05:19 -0800,41,133 +211,6890,2013-11-10 17:10:02 -0800,41,132 +212,3490,2013-11-09 01:00:25 -0800,42,139 +213,6470,2013-11-12 04:10:02 -0800,42,139 +214,1594,2013-11-10 00:30:40 -0800,43,141 +215,6498,2013-11-10 17:38:00 -0800,43,141 +216,5395,2013-11-08 18:05:00 -0800,43,144 +217,7730,2013-11-10 14:39:55 -0800,43,142 +218,2584,2013-11-09 12:03:56 -0800,43,143 +219,2450,2013-11-09 17:06:22 -0800,43,144 +220,7117,2013-11-09 13:30:02 -0800,44,146 +221,6370,2013-11-07 14:32:09 -0800,44,146 +222,8861,2013-11-09 10:37:07 -0800,44,145 +223,6622,2013-11-11 12:30:20 -0800,44,146 +224,8845,2013-11-12 01:50:28 -0800,44,146 +225,4990,2013-11-10 16:40:30 -0800,44,145 +226,6448,2013-11-10 23:53:41 -0800,44,145 +227,4050,2013-11-08 20:21:18 -0800,44,145 +228,9730,2013-11-08 05:44:39 -0800,45,149 +229,420,2013-11-08 05:31:35 -0800,45,147 +230,6014,2013-11-08 13:31:46 -0800,46,152 +231,4474,2013-11-06 17:58:22 -0800,46,153 +232,4126,2013-11-12 07:06:00 -0800,46,154 +233,6039,2013-11-06 21:39:13 -0800,46,152 +234,6180,2013-11-07 15:37:14 -0800,46,153 +235,2060,2013-11-07 10:10:36 -0800,47,156 +236,7097,2013-11-10 07:22:42 -0800,47,157 +237,8480,2013-11-08 01:57:37 -0800,47,156 +238,5465,2013-11-11 02:05:43 -0800,48,159 +239,8410,2013-11-13 07:46:50 -0800,48,158 +240,4094,2013-11-06 21:47:49 -0800,48,158 diff --git a/test_data/test_vendors.csv b/test_data/test_vendors.csv new file mode 100644 index 00000000..ac917038 --- /dev/null +++ b/test_data/test_vendors.csv @@ -0,0 +1,48 @@ +1,Feil-Farrell,8,1 +2,"Hamill, Kilback and Pfeffer",5,1 +3,Breitenberg Inc,5,1 +4,Kris and Sons,5,1 +5,"Reynolds, Schmitt and Klocko",3,1 +6,Zulauf and Sons,8,1 +7,Bechtelar Inc,4,2 +8,Stamm Inc,2,2 +9,"Quigley, Breitenberg and Schuster",2,2 +10,Kertzmann LLC,11,3 +11,Donnelly-Quigley,7,3 +12,Windler Inc,4,3 +13,"Grady, Hudson and Olson",11,4 +14,Stracke Group,2,4 +15,Hyatt-King,3,4 +16,Homenick-Kuhn,4,4 +17,"Langosh, Krajcik and Langosh",11,5 +18,Von-Hamill,10,5 +19,Labadie-Tremblay,2,6 +20,Ledner Group,7,6 +21,Upton-Bruen,10,6 +22,Runolfsson and Sons,2,7 +23,"Wilderman, Marks and Luettgen",3,7 +24,"Heaney, Schiller and Stehr",7,8 +25,"Veum, Dickinson and Conroy",9,8 +26,Schmitt Group,3,8 +27,Ankunding-Prosacco,10,8 +28,Watsica and Sons,10,8 +29,"White, Smith and Weimann",7,8 +30,"Koelpin, Koelpin and Wintheiser",10,9 +31,Bernhard-Harber,6,9 +32,Jakubowski-Robel,7,9 +33,"Breitenberg, Mante and Glover",2,9 +34,Jacobs-McGlynn,10,9 +35,Runolfsdottir Inc,9,9 +36,Wuckert Inc,4,9 +37,"Gerhold, Reilly and Morissette",9,9 +38,"Marvin, Casper and Krajcik",10,9 +39,Weissnat LLC,11,9 +40,Dickens-Weissnat,1,10 +41,Kessler-Ziemann,1,10 +42,"Tillman, Lockman and Klein",9,10 +43,Cartwright LLC,11,10 +44,"Kassulke, Leannon and Bins",7,10 +45,"Hyatt, Conroy and Ortiz",5,10 +46,Cartwright-VonRueden,3,10 +47,Yost LLC,6,10 +48,Greenfelder Inc,8,10 From 1a38a4942d9ca7c3e5d6c49c29a88c53803423fd Mon Sep 17 00:00:00 2001 From: noglows Date: Thu, 22 Oct 2015 11:09:10 -0700 Subject: [PATCH 26/35] Modified class files to take csv as an input --- lib/far_mar/market.rb | 43 ++++++++++++++++++++++++++----------- lib/far_mar/product.rb | 4 ++-- lib/far_mar/sale.rb | 4 ++-- lib/far_mar/vendor.rb | 25 ++++++++++++++++----- spec/far_mar/vendor_spec.rb | 9 ++++++++ 5 files changed, 64 insertions(+), 21 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 719c100d..ff59a6c9 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -1,6 +1,6 @@ module FarMar class Market - attr_accessor :id, :name, :markets_all + attr_accessor :id, :name, :markets_all, :all_vendors def initialize(market_hash) @id = market_hash[:id].to_i @name = market_hash[:name] @@ -11,12 +11,12 @@ def initialize(market_hash) @zip = market_hash[:zip] end - def self.all + def self.all(csv = "support/markets.csv") # Only reload the CSV if @markets is empty array @@markets ||= [] if @@markets == [] #binding.pry - markets_csv = CSV.read("support/markets.csv") + markets_csv = CSV.read(csv) markets_csv.each do |id, name, address, city, county, state, zip| hash = {:id => id, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} market = FarMar::Market.new(hash) @@ -53,19 +53,37 @@ def products # Returns a collection of Market instances where the market name or vendor name contain the search term def self.search(search_term) - #FarMar::Market.all - #FarMar::Vendor.all - # WORK IN PROGRESS + match_search = [] + markets = FarMar::Market.all + vendors = FarMar::Vendor.all + markets.each do |market| + if market.name.include? search_term + match_search.push(market) + end + end + vendors.each do |vendor| + if vendor.name.include? search_term + match_search.push(vendor.market) + end + end end + def sorted_vendor + @all_vendors ||= [] + if @all_vendors == [] + @all_vendors = self.vendors + @all_vendors.sort_by! { |vendor| vendor.revenue } + end + return @all_vendors + end # Returns the vendor with the highest revenue # Can take a date as an input to return the vendor with the highest revenue on a given date def preferred_vendor(date = nil) + sorted_vendor if date == nil - all_vendors = self.vendors - all_vendors.sort_by! { |vendor| vendor.revenue } - return all_vendors[-1] + return @all_vendors[-1] else + ## ACCOMODATE TAKING A DATE AS INPUT HERE end end @@ -73,10 +91,11 @@ def preferred_vendor(date = nil) # Returns the vendor with the lowest revenue # Can take a date as an input to return the vendor with the lowest revenue on a given date def worst_vendor(date = nil) + sorted_vendor if date == nil - all_vendors = self.vendors - all_vendors.sort_by! { |vendor| vendor.revenue } - return all_vendors[0] + #all_vendors = self.vendors + #all_vendors.sort_by! { |vendor| vendor.revenue } + return @all_vendors[0] else ## ACCOMODATE TAKING A DATE AS INPUT HERE end diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index b41c1d35..ef9ec5df 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -9,11 +9,11 @@ def initialize(product_hash) end # Return a collection of all Product instances, representing all the products described in the CSV - def self.all + def self.all(csv = "support/products.csv") # Only reload the CSV if @products is empty array @@products ||= [] if @@products == [] - products_csv = CSV.read("support/products.csv") + products_csv = CSV.read(csv) products_csv.each do |id, name, vendor_id| hash = {:id => id, :name => name, :vendor_id => vendor_id} diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index 5dcb8a06..62609e79 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -12,11 +12,11 @@ def initialize(sale_hash) end # Returns a collection of Sale instances, representing all of the sales described in the CSV - def self.all + def self.all(csv = "support/sales.csv") # Only reload the CSV is sales is empty array @@sales ||= [] if @@sales == [] - sales_csv = CSV.read("support/sales.csv") + sales_csv = CSV.read(csv) sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| hash = {:id => id, :amount => amount, :purchase_time => purchase_time, :vendor_id => vendor_id, :product_id => product_id} diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 41b89e6b..a9accc11 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -10,11 +10,11 @@ def initialize(vendor_hash) end # Returns a collection of Vendor instances, representing all the vendors described in the CSV - def self.all + def self.all(csv = "support/vendors.csv") # Only reload the CSV if @vendors is empty array @@vendors ||= [] if @@vendors == [] - vendors_csv = CSV.read("support/vendors.csv") + vendors_csv = CSV.read(csv) vendors_csv.each do |id, name, num_employees, market_id| hash = {:id => id, :name => name, :employees => num_employees, :market_id => market_id} @@ -45,10 +45,15 @@ def products end # Returns a collection of FarMar::Sale instances that are associated with the vendor - def sales + def sales(date = nil) sales = FarMar::Sale.all - matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id} - return matched_sales + if date == nil + matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id} + return matched_sales + else + # purchase_day = date.strftime() + # matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id && sale.purchase_time} + end end # Returns the sum of all the vendor's sale (in cents) @@ -67,5 +72,15 @@ def self.by_market(market_id) matched_vendors = vendors.find_all { |vendor| vendor.market_id == market_id} return matched_vendors end + + # Returns the top n vendor instances ranked by total revenue + # def self.most_revenue(n) + # vendors = FarMar::Vendor.all + # if n < vendors.length + # max = vendors.max_by! { |vendor| vendor.revenue} + # return max + # end + # end + end end diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index 7449bb8c..2601c3f2 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -89,4 +89,13 @@ expect(test_vendor.revenue).to eq 38259 end end + + # describe ".most_revenue" do + # it "returns an array of n values" do + # number_of_vals = 3 + # expect(FarMar::Vendor.most_revenue(number_of_vals).length).to eq number_of_vals + # expect(FarMar::Vendor.most_revenue(number_of_vals)).to be_an_instance_of Array + # end + # end + end From 88cd3da256d8df503b440a1e3308d375f7a1d17e Mon Sep 17 00:00:00 2001 From: noglows Date: Thu, 22 Oct 2015 11:43:59 -0700 Subject: [PATCH 27/35] Added self.search method to Market class --- lib/far_mar/market.rb | 9 +++++---- spec/far_mar/market_spec.rb | 7 ++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index ff59a6c9..37e6acd6 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -54,18 +54,19 @@ def products # Returns a collection of Market instances where the market name or vendor name contain the search term def self.search(search_term) match_search = [] - markets = FarMar::Market.all - vendors = FarMar::Vendor.all + markets = FarMar::Market.all("./support/markets.csv") + vendors = FarMar::Vendor.all("./support/vendors.csv") markets.each do |market| - if market.name.include? search_term + if market.name.downcase.include? search_term.downcase match_search.push(market) end end vendors.each do |vendor| - if vendor.name.include? search_term + if vendor.vendor_name.downcase.include? search_term.downcase match_search.push(vendor.market) end end + return match_search end def sorted_vendor diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index 3b196024..2355c547 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -3,7 +3,6 @@ describe FarMar::Market do before :each do @markets = FarMar::Market.all - end describe "#new" do @@ -86,7 +85,13 @@ min = all_vendors.min_by { |i| i.revenue} expect(sample_market.worst_vendor).to eq min end + end + describe ".search" do + it "returns the correct number of entries for the sample search" do + sample_search = 'school' + expect(FarMar::Market.search(sample_search).length).to eq 3 + end end end From 0a0f2ea35f9c15b1cf2896dc3eff8489fbf58411 Mon Sep 17 00:00:00 2001 From: noglows Date: Thu, 22 Oct 2015 15:27:07 -0700 Subject: [PATCH 28/35] Working preffered_vendor(date) method --- lib/far_mar.rb | 1 + lib/far_mar/market.rb | 37 ++++++++++++++++++++++++++++++++----- lib/far_mar/sale.rb | 3 +++ spec/far_mar/market_spec.rb | 13 +++++++++++++ test.rb | 15 +++++++++++++++ 5 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 test.rb diff --git a/lib/far_mar.rb b/lib/far_mar.rb index 15571bd0..9c990a1c 100644 --- a/lib/far_mar.rb +++ b/lib/far_mar.rb @@ -1,6 +1,7 @@ require "csv" require "time" require "pry" +require "date" require "./lib/far_mar/market" require "./lib/far_mar/vendor" diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 37e6acd6..35e3527a 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -73,19 +73,46 @@ def sorted_vendor @all_vendors ||= [] if @all_vendors == [] @all_vendors = self.vendors - @all_vendors.sort_by! { |vendor| vendor.revenue } + #@all_vendors.sort_by! { |vendor| vendor.revenue } end return @all_vendors end # Returns the vendor with the highest revenue # Can take a date as an input to return the vendor with the highest revenue on a given date - def preferred_vendor(date = nil) - sorted_vendor - if date == nil + # date must be provided as year, month, day + def preferred_vendor(year = nil, month = nil, day = nil) + vendors = sorted_vendor + sales_day = [] + if day == nil + vendors.sort_by! { |vendor| vendor.revenue } return @all_vendors[-1] else + start_time = DateTime.new(year,month,day) + end_time = start_time + 1 - ## ACCOMODATE TAKING A DATE AS INPUT HERE + sales = FarMar::Sale.all + sales.each do |sale| + if sale.purchase_time.day >= start_time.day && sale.purchase_time.day < end_time.day + sales_day.push(sale) + end + end + sales_day.sort_by!{ |sale| sale.sale_id } + + market_sales = [] + vendors.each do |vendor| + sales_day.each do |sale| + if vendor.vendor_id == sale.vendor_id + market_sales.push(sale) + end + end + end + + vendor_hash = Hash.new(0) + market_sales.each do |sale| + vendor_hash[sale.vendor_id] += sale.amount + end + sorted = vendor_hash.sort_by { |vendor, rev| rev} + return FarMar::Vendor.find(sorted[-1][0]) end end diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index 62609e79..e1d0cb80 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -6,6 +6,9 @@ def initialize(sale_hash) @sale_id = sale_hash[:id].to_i @amount = sale_hash[:amount].to_i @purchase_time = DateTime.parse(sale_hash[:purchase_time]) + + #DateTime.strptime('2001-02-03T04:05:06+07:00', '%Y-%m-%dT%H:%M:%S%z') + #=> # #@purchase_time = sale_hash[:purchase_time] ### NEEDS TO BE DATETIME @vendor_id = sale_hash[:vendor_id].to_i @product_id = sale_hash[:product_id].to_i diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index 2355c547..da2e2f0f 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -70,6 +70,15 @@ max = all_vendors.max_by { |i| i.revenue} expect(sample_market.preferred_vendor).to eq max end + it "when passed a date, returns a vendor objects" do + sample_market = @markets[1] + expect(sample_market.preferred_vendor(2013,11,7)).not_to eq nil + expect(sample_market.preferred_vendor(2013,11,7)).to be_an_instance_of FarMar::Vendor + end + it "when passed a date, returns the expected vendor" do + sample_market = @markets[1] + expect(sample_market.preferred_vendor(2013,11,7).vendor_name).to eq "Bechtelar Inc" + end end @@ -92,6 +101,10 @@ sample_search = 'school' expect(FarMar::Market.search(sample_search).length).to eq 3 end + + it "returns can also search for vendors" do + expect(FarMar::Market.search("Watsica")[0].name).to eq "Charlestown Farmers Market" + end end end diff --git a/test.rb b/test.rb new file mode 100644 index 00000000..e804072d --- /dev/null +++ b/test.rb @@ -0,0 +1,15 @@ +require 'date' + +#time = DateTime.parse('2013-11-07 00:00:00+00:00', '%Y-%m-%dT%H:%M:%S%z') +#test_time = DateTime.parse('2013-11-07 19:30:03 -0800', '%Y-%m-%dT%H:%M:%S%z') + +time = DateTime.parse('2013-11-07 00:00:00+00:00') +end_time = time+1 +test_time = DateTime.parse('2013-11-07 19:30:03 -0800') + +puts test_time.day >= time.day # expect true +puts test_time.day > end_time.day # expect false + +puts time +puts end_time +puts test_time From 29864c8a4b6bc7d57cef466d9bf4f4a2b141253d Mon Sep 17 00:00:00 2001 From: noglows Date: Thu, 22 Oct 2015 16:55:37 -0700 Subject: [PATCH 29/35] Functioning worst_vendor(date) method in Market class --- lib/far_mar/market.rb | 57 ++++++++++++++++++++++++++++++++----- spec/far_mar/market_spec.rb | 9 ++++++ 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index 35e3527a..e5fa00f2 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -118,17 +118,60 @@ def preferred_vendor(year = nil, month = nil, day = nil) # Returns the vendor with the lowest revenue # Can take a date as an input to return the vendor with the lowest revenue on a given date - def worst_vendor(date = nil) - sorted_vendor - if date == nil - #all_vendors = self.vendors - #all_vendors.sort_by! { |vendor| vendor.revenue } + def worst_vendor(year = nil, month = nil, day = nil) + vendors = sorted_vendor + sales_day = [] + if day == nil + vendors.sort_by! { |vendor| vendor.revenue } return @all_vendors[0] else - ## ACCOMODATE TAKING A DATE AS INPUT HERE + start_time = DateTime.new(year,month,day) + end_time = start_time + 1 + + sales = FarMar::Sale.all + sales.each do |sale| + if sale.purchase_time.day >= start_time.day && sale.purchase_time.day < end_time.day + sales_day.push(sale) + end + end + sales_day.sort_by!{ |sale| sale.sale_id } + + market_sales = [] + #vendor_sales = [] + + vendors.each do |vendor| + vendor_sales = [] + sales_day.each do |sale| + #vendor_sales = [] + if vendor.vendor_id == sale.vendor_id + vendor_sales.push(sale) + end + end + if vendor_sales == [] + vendor_sales.push("NoSales:#{vendor.vendor_id}") + end + market_sales.push(vendor_sales) + end + + market_sales.flatten! + + + vendor_hash = Hash.new(0) + market_sales.each do |sale| + if sale.class != FarMar::Sale + sale = sale.split(':')[1] + #binding.pry + return FarMar::Vendor.find(sale.to_i) + + else + vendor_hash[sale.vendor_id] += sale.amount + end + end + sorted = vendor_hash.sort_by { |vendor, rev| rev} + return FarMar::Vendor.find(sorted[0][0]) end - end + end end end diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index da2e2f0f..1bac7ed6 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -94,6 +94,15 @@ min = all_vendors.min_by { |i| i.revenue} expect(sample_market.worst_vendor).to eq min end + it "when passed a date, returns a vendor objects" do + sample_market = @markets[1] + expect(sample_market.worst_vendor(2013,11,7)).not_to eq nil + expect(sample_market.worst_vendor(2013,11,7)).to be_an_instance_of FarMar::Vendor + end + it "when passed a date, returns the expected vendor" do + sample_market = @markets[1] + expect(sample_market.worst_vendor(2013,11,7).vendor_name).to eq "Quigley, Breitenberg and Schuster" + end end describe ".search" do From 53cd0e10bba7c19b9bb42d9eab616d9105b29e8a Mon Sep 17 00:00:00 2001 From: noglows Date: Fri, 23 Oct 2015 09:47:13 -0700 Subject: [PATCH 30/35] Added comments to all Class files --- To-Do.txt | 2 ++ lib/far_mar/market.rb | 62 ++++++++++++++++++++++++++++-------------- lib/far_mar/product.rb | 3 +- lib/far_mar/sale.rb | 10 ++----- lib/far_mar/vendor.rb | 12 ++------ 5 files changed, 51 insertions(+), 38 deletions(-) diff --git a/To-Do.txt b/To-Do.txt index 69a80487..95c7b77b 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -2,3 +2,5 @@ # Improve #vendors spec - suspect this could be written more efficiently # Rewrite the vendor by_market spec - using length but should be testing result accuracy # Rewrite tests to take test data +# Investigate .nip +# accomodate multiple best and worst vendors diff --git a/lib/far_mar/market.rb b/lib/far_mar/market.rb index e5fa00f2..33d6d6e4 100644 --- a/lib/far_mar/market.rb +++ b/lib/far_mar/market.rb @@ -11,29 +11,35 @@ def initialize(market_hash) @zip = market_hash[:zip] end + # Returns a collection of all market instances, representing all the markets described in the CSV def self.all(csv = "support/markets.csv") - # Only reload the CSV if @markets is empty array + # Only reload the CSV if @@markets is an empty array @@markets ||= [] if @@markets == [] - #binding.pry markets_csv = CSV.read(csv) + # Create a new market object for each row in the CSV markets_csv.each do |id, name, address, city, county, state, zip| hash = {:id => id, :name => name, :address => address, :city => city, :county => county, :state => state, :zip => zip} market = FarMar::Market.new(hash) @@markets.push(market) end end + # Return array of all market objects return @@markets end + # Returns an instance of Market where the value of the ID field matches the passed parameter def self.find(id) @@markets.find do |market| market.id == id end end + # Returns a collection of Vendor instances that are associated with the market def vendors + # Generate the vendor list vendors = FarMar::Vendor.all + # Find the vendors with matching market ids matched_vendors = vendors.find_all do |vendor| vendor.market_id == self.id end @@ -45,7 +51,9 @@ def vendors # Returns a collection of product instances that are associated to the market though the FarMar::Vendor class def products products = [] + # Find the vendors that correlate to the market in question matched_vendors = self.vendors + # For each vendor, pull the product list and add to an array matched_vendors.each { |vendor| products.push(vendor.products)} products.flatten! return products @@ -53,14 +61,18 @@ def products # Returns a collection of Market instances where the market name or vendor name contain the search term def self.search(search_term) + # initialize the matches array match_search = [] + # Generate all markets and vendors markets = FarMar::Market.all("./support/markets.csv") vendors = FarMar::Vendor.all("./support/vendors.csv") + # Check market names for matches. If a match is found, push it to the match_search array markets.each do |market| if market.name.downcase.include? search_term.downcase match_search.push(market) end end + # Check vendor names for matches. Push any matches to the array. vendors.each do |vendor| if vendor.vendor_name.downcase.include? search_term.downcase match_search.push(vendor.market) @@ -69,36 +81,44 @@ def self.search(search_term) return match_search end - def sorted_vendor + # Helper method to simplify preferred_vendor and worst_vendor methods (code is shared between the two) + # runs self.vendors only if it hasn't already been run + def matched_vendor @all_vendors ||= [] if @all_vendors == [] @all_vendors = self.vendors - #@all_vendors.sort_by! { |vendor| vendor.revenue } end return @all_vendors end - # Returns the vendor with the highest revenue - # Can take a date as an input to return the vendor with the highest revenue on a given date + + # Returns the vendor with the highest revenue (Can also take a date as an input to return the vendor with the highest revenue on a given date) # date must be provided as year, month, day + # default value is nil - if a date is not entered, the function returns the best vendor for all days def preferred_vendor(year = nil, month = nil, day = nil) - vendors = sorted_vendor + vendors = matched_vendor sales_day = [] + # If no date is provided, the vendor array is sorted and the vendor with the highest revenue is returned if day == nil vendors.sort_by! { |vendor| vendor.revenue } return @all_vendors[-1] + # If a date is provided the method will return the vendor with the highest revenue for that date else + # Create a DateTime object with the provided date start_time = DateTime.new(year,month,day) + # end_time is one day later end_time = start_time + 1 + # Generate all sales sales = FarMar::Sale.all + # Narrow sales down to only the sales for the day by iterating through sales and checking if the purchase_time falls into the day range (this could be rewritten to use the Sale.between method. It was causing a lot of issues so I just rewrote the function here) sales.each do |sale| if sale.purchase_time.day >= start_time.day && sale.purchase_time.day < end_time.day sales_day.push(sale) end end - sales_day.sort_by!{ |sale| sale.sale_id } market_sales = [] + # For each vendor, iterate through the sales for the day and see if the sale is associated with the vendor vendors.each do |vendor| sales_day.each do |sale| if vendor.vendor_id == sale.vendor_id @@ -106,20 +126,24 @@ def preferred_vendor(year = nil, month = nil, day = nil) end end end - + # Initizalize a new hash with a default value of 0 vendor_hash = Hash.new(0) + # Iterate through each matching sale and set the hash to use the vendor_id as the key and update the value to the sale amount. If you have multiple sales for a vendor, the purchase_amounts are summed in the value. market_sales.each do |sale| vendor_hash[sale.vendor_id] += sale.amount end + # Sort the hash in revenue order (by value) sorted = vendor_hash.sort_by { |vendor, rev| rev} + # Return the vendor associated with the key for the last item in sorted return FarMar::Vendor.find(sorted[-1][0]) end end # Returns the vendor with the lowest revenue # Can take a date as an input to return the vendor with the lowest revenue on a given date + # Works very simialrily to preferred_vendor - comments below detail the differences between the 2. All other functionality should be assumed to be the same. def worst_vendor(year = nil, month = nil, day = nil) - vendors = sorted_vendor + vendors = matched_vendor sales_day = [] if day == nil vendors.sort_by! { |vendor| vendor.revenue } @@ -137,32 +161,32 @@ def worst_vendor(year = nil, month = nil, day = nil) sales_day.sort_by!{ |sale| sale.sale_id } market_sales = [] - #vendor_sales = [] vendors.each do |vendor| vendor_sales = [] sales_day.each do |sale| - #vendor_sales = [] if vendor.vendor_id == sale.vendor_id vendor_sales.push(sale) end end + # Difference from preferred_vendor: Need to accomodate that there may be a vendor without a sale for the day. We need to return this vendor as the worst vendor. + # If after going through the sales for the day, the vendor_sales array is empty, push a string into the array. if vendor_sales == [] vendor_sales.push("NoSales:#{vendor.vendor_id}") end market_sales.push(vendor_sales) end - + # Flatten creates a single array from an array of arrays market_sales.flatten! - vendor_hash = Hash.new(0) market_sales.each do |sale| + # If an item in the array is not a Sale, we know it is one of the strings we placed earlier (for a no sale situation) if sale.class != FarMar::Sale - sale = sale.split(':')[1] - #binding.pry - return FarMar::Vendor.find(sale.to_i) - + # split the string to get just the vendor_id and find the associated vendor object. Return this vendor as the worst vendor + sale = sale.split(':')[1].to_i + return FarMar::Vendor.find(sale) + # Otherwise the behavior is the same as preffered_vendor else vendor_hash[sale.vendor_id] += sale.amount end @@ -170,8 +194,6 @@ def worst_vendor(year = nil, month = nil, day = nil) sorted = vendor_hash.sort_by { |vendor, rev| rev} return FarMar::Vendor.find(sorted[0][0]) end - - end end end diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index ef9ec5df..dc66ce6f 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -13,8 +13,8 @@ def self.all(csv = "support/products.csv") # Only reload the CSV if @products is empty array @@products ||= [] if @@products == [] + # Create a new Product object for each row in the CSV and add the products to an array products_csv = CSV.read(csv) - products_csv.each do |id, name, vendor_id| hash = {:id => id, :name => name, :vendor_id => vendor_id} product = FarMar::Product.new(hash) @@ -52,6 +52,5 @@ def self.by_vendor(vendor_id) matched_products = all_products.find_all { |product| product.vendor_id == vendor_id } return matched_products end - end end diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index e1d0cb80..c5ea7395 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -6,10 +6,6 @@ def initialize(sale_hash) @sale_id = sale_hash[:id].to_i @amount = sale_hash[:amount].to_i @purchase_time = DateTime.parse(sale_hash[:purchase_time]) - - #DateTime.strptime('2001-02-03T04:05:06+07:00', '%Y-%m-%dT%H:%M:%S%z') - #=> # - #@purchase_time = sale_hash[:purchase_time] ### NEEDS TO BE DATETIME @vendor_id = sale_hash[:vendor_id].to_i @product_id = sale_hash[:product_id].to_i end @@ -20,7 +16,6 @@ def self.all(csv = "support/sales.csv") @@sales ||= [] if @@sales == [] sales_csv = CSV.read(csv) - sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| hash = {:id => id, :amount => amount, :purchase_time => purchase_time, :vendor_id => vendor_id, :product_id => product_id} sale = FarMar::Sale.new(hash) @@ -49,17 +44,18 @@ def product # Returns a collection of FarMar::Sale objects where the purchase time is between the two given times def self.between(beginning_time, end_time) + # generate all Sale objects all_sales = FarMar::Sale.all sales_between = [] + # For each sale, check if the purchase time is between is between the giving beginning_time and end_time all_sales.find_all do |sale| if sale.purchase_time > beginning_time && sale.purchase_time < end_time sales_between.push(sale) end end + # return a sorted list of sales sales_between.sort_by! { |sale| sale.purchase_time } return sales_between end - - end end diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index a9accc11..81c695ff 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -15,7 +15,6 @@ def self.all(csv = "support/vendors.csv") @@vendors ||= [] if @@vendors == [] vendors_csv = CSV.read(csv) - vendors_csv.each do |id, name, num_employees, market_id| hash = {:id => id, :name => name, :employees => num_employees, :market_id => market_id} vendor = FarMar::Vendor.new(hash) @@ -45,15 +44,10 @@ def products end # Returns a collection of FarMar::Sale instances that are associated with the vendor - def sales(date = nil) + def sales sales = FarMar::Sale.all - if date == nil - matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id} - return matched_sales - else - # purchase_day = date.strftime() - # matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id && sale.purchase_time} - end + matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id} + return matched_sales end # Returns the sum of all the vendor's sale (in cents) From e397b5fd828e2ebfeb52e36e3e8503789ac56f86 Mon Sep 17 00:00:00 2001 From: noglows Date: Fri, 23 Oct 2015 14:17:14 -0700 Subject: [PATCH 31/35] Working most_revenue method for Product class --- lib/far_mar/product.rb | 33 ++++++++- spec/far_mar/market_spec.rb | 4 + spec/far_mar/product_spec.rb | 14 ++++ spec/spec_helper.rb | 4 + test_data/test_products.csv | 139 ----------------------------------- test_data/test_sales.csv | 135 ---------------------------------- 6 files changed, 52 insertions(+), 277 deletions(-) diff --git a/lib/far_mar/product.rb b/lib/far_mar/product.rb index dc66ce6f..907a49b3 100644 --- a/lib/far_mar/product.rb +++ b/lib/far_mar/product.rb @@ -1,6 +1,5 @@ module FarMar class Product - attr_accessor :product_id, :product_name, :vendor_id def initialize(product_hash) @product_id = product_hash[:id].to_i @@ -35,8 +34,8 @@ def vendor end # Returns a collection for FarMar::Sale instances associated with the product - def sales - all_sales = FarMar::Sale.all + def sales(csv = "./support/sales.csv") + all_sales = FarMar::Sale.all(csv) matched_sales = all_sales.find_all { |sale| sale.product_id == self.product_id } return matched_sales end @@ -52,5 +51,33 @@ def self.by_vendor(vendor_id) matched_products = all_products.find_all { |product| product.vendor_id == vendor_id } return matched_products end + + # Returns the top n product instances ranked by total revenue + # Written so that the method only runs on a partial version of the data. Needs to be optimized so it can run on the full data without taking forever + def self.most_revenue(n) + return_array = [] + @@sales = [] + @@products = [] + products = FarMar::Product.all("./test_data/test_products.csv") + #products = FarMar::Product.all("./support/products.csv") + product_sales = Hash.new(0) + products.each do |product| + associated_sales = product.sales("./test_data/test_sales.csv") + #associated_sales = product.sales("./support/sales.csv") + revenue = 0 + associated_sales.each do |sale| + revenue += sale.amount + end + product_sales[product.product_id] = revenue + end + sorted = product_sales.sort_by { |product, rev| rev } + sorted.reverse! + best_products = sorted[0...n] + best_products.each do |product| + return_array.push(FarMar::Product.find(product[0])) + end + return return_array + end + end end diff --git a/spec/far_mar/market_spec.rb b/spec/far_mar/market_spec.rb index 1bac7ed6..e3bfd55c 100644 --- a/spec/far_mar/market_spec.rb +++ b/spec/far_mar/market_spec.rb @@ -103,6 +103,10 @@ sample_market = @markets[1] expect(sample_market.worst_vendor(2013,11,7).vendor_name).to eq "Quigley, Breitenberg and Schuster" end + it "can return a vendor with 0 sales" do + sample_market = @markets[2] + expect(sample_market.worst_vendor(2013,11,7).vendor_name).to eq "Kertzmann LLC" + end end describe ".search" do diff --git a/spec/far_mar/product_spec.rb b/spec/far_mar/product_spec.rb index 7a969d0c..de7f4979 100644 --- a/spec/far_mar/product_spec.rb +++ b/spec/far_mar/product_spec.rb @@ -72,4 +72,18 @@ end end + describe ".most_revenue" do + it "returns an array of length n" do + result = FarMar::Product.most_revenue(10) + expect(result.length).to eq 10 + expect(result).to be_an_instance_of Array + expect(result[0]).to be_an_instance_of FarMar::Product + end + it "returns the correct product for a test data set" do + expected_product_name = "Yummy Fruit" + result = FarMar::Product.most_revenue(10) + expect(result[0].product_name).to eq expected_product_name + end + end + end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 03753ffe..485451f2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,3 +2,7 @@ SimpleCov.start require "./lib/far_mar" + +# RSpec.configure do |config| +# config.order = 'random' +# end diff --git a/test_data/test_products.csv b/test_data/test_products.csv index 9d56c0f2..29e913c1 100644 --- a/test_data/test_products.csv +++ b/test_data/test_products.csv @@ -18,142 +18,3 @@ 18,Yellow Bread,8 19,Jealous Burrito,9 20,Tall Pretzel,9 -21,Embarrassed Bread,9 -22,Purring Beets,9 -23,Calm Carrots,10 -24,Fierce Beef,10 -25,Helpless Bread,10 -26,Yummy Bread,10 -27,Broken Beets,10 -28,Quiet Honey,11 -29,Crazy Fish,11 -30,Depressed Beets,11 -31,Sore Chicken,11 -32,Disgusted Carrots,11 -33,Tired Bread,12 -34,Clumsy Chicken,12 -35,Massive Apples,12 -36,Mute Beef,13 -37,Grand Honey,13 -38,Bland Burrito,13 -39,Horrible Burrito,14 -40,Bad Chicken,14 -41,Thundering Carrots,15 -42,Grubby Beef,15 -43,Skinny Mushrooms,15 -44,Repulsive Chicken,15 -45,Bland Chicken,16 -46,Miniature Fish,16 -47,Delicious Carrots,16 -48,Robust Burrito,16 -49,M Greens,16 -50,Quaint Bread,17 -51,Successful Apples,18 -52,Sticky Fish,18 -53,– Bread,18 -54,Miniature Beets,18 -55,Delightful Chicken,19 -56,Nom nom Beef,19 -57,Anxious Carrots,19 -58,Thoughtless Honey,20 -59,Cheerful Fish,21 -60,Colossal Beets,21 -61,Amused Apples,21 -62,Righteous Fish,21 -63,Rainy Bread,21 -64,Fresh Apples,22 -65,Worried Pretzel,22 -66,Homeless Honey,22 -67,Loose Fish,22 -68,Better Apples,23 -69,Swift Pretzel,23 -70,Annoyed Fish,23 -71,Mighty Beef,23 -72,Ordinary Honey,23 -73,Jolly Greens,24 -74,Amused Beets,25 -75,Obnoxious Fruit,26 -76,Tough Beets,26 -77,Harsh Greens,26 -78,High Mushrooms,27 -79,Weak Fish,27 -80,Steep Beets,27 -81,Worried Pretzel,27 -82,Dangerous Mushrooms,27 -83,Silly Beef,28 -84,Hushed Honey,28 -85,Agreeable Honey,28 -86,Incredible Burrito,29 -87,Combative Bread,29 -88,Clumsy Chicken,29 -89,Pickled Mushrooms,30 -90,Tense Greens,30 -91,Spicy Mushrooms,30 -92,Frightened Honey,31 -93,Upset Honey,31 -94,Quaint Greens,31 -95,Dirty Mushrooms,31 -96,Harsh Carrots,31 -97,Jolly Beef,32 -98,Watery Pretzel,32 -99,Hot Beef,32 -100,Blue Chicken,32 -101,Mute Chicken,33 -102,Rainy Fish,33 -103,Short Greens,33 -104,Nutty Pretzel,34 -105,Happy Mushrooms,34 -106,Tan Fruit,34 -107,Colossal Greens,34 -108,Perfect Apples,34 -109,Late Mushrooms,35 -110,Smiling Beef,35 -111,Spotty Chicken,35 -112,Jolly Beef,35 -113,Tall Carrots,36 -114,Short Beets,36 -115,Stupendous Greens,36 -116,Better Beef,36 -117,Jolly Apples,36 -118,Dry Beef,37 -119,Rotten Bread,38 -120,Heavy Fruit,38 -121,Immense Honey,38 -122,Lazy Greens,38 -123,Kickin' Pretzel,38 -124,Silly Greens,39 -125,Panicky Bread,39 -126,Jittery Mushrooms,39 -127,Helpful Fish,40 -128,Nice Mushrooms,40 -129,Friendly Burrito,40 -130,Bitter Pretzel,40 -131,Tasteless Greens,40 -132,Sharp Chicken,41 -133,– Fish,41 -134,High Fish,41 -135,Bland Apples,41 -136,Pretty Fruit,42 -137,Great Bread,42 -138,Tough Beets,42 -139,Fluffy Beef,42 -140,Splendid Honey,42 -141,Hurt Honey,43 -142,Precious Fish,43 -143,Striped Beef,43 -144,Husky Beets,43 -145,Pretty Beets,44 -146,Watery Fish,44 -147,Robust Beef,45 -148,Helpless Beets,45 -149,Heavy Honey,45 -150,Rotten Bread,45 -151,Exuberant Mushrooms,45 -152,Many Beef,46 -153,Elated Pretzel,46 -154,Grubby Beets,46 -155,Frightened Beets,46 -156,Faithful Fruit,47 -157,Square Honey,47 -158,Grumpy Fruit,48 -159,Tight Bread,48 diff --git a/test_data/test_sales.csv b/test_data/test_sales.csv index b942d4cc..aef3bdbf 100644 --- a/test_data/test_sales.csv +++ b/test_data/test_sales.csv @@ -103,138 +103,3 @@ 103,3310,2013-11-09 10:25:22 -0800,20,58 104,5690,2013-11-11 06:23:19 -0800,20,58 105,8672,2013-11-08 12:28:53 -0800,20,58 -106,7028,2013-11-07 22:40:04 -0800,21,60 -107,3779,2013-11-08 05:40:53 -0800,21,60 -108,822,2013-11-11 01:44:44 -0800,21,63 -109,1826,2013-11-10 02:53:07 -0800,21,59 -110,3751,2013-11-07 21:31:14 -0800,21,62 -111,5889,2013-11-09 20:25:45 -0800,21,62 -112,7797,2013-11-11 13:48:16 -0800,22,64 -113,4564,2013-11-06 18:33:45 -0800,22,64 -114,4548,2013-11-08 01:47:50 -0800,22,65 -115,7870,2013-11-10 07:07:29 -0800,22,66 -116,6858,2013-11-09 06:00:22 -0800,22,67 -117,7912,2013-11-10 08:21:58 -0800,22,65 -118,785,2013-11-11 14:35:45 -0800,23,72 -119,1664,2013-11-12 15:45:49 -0800,23,69 -120,1810,2013-11-10 22:19:43 -0800,23,70 -121,4890,2013-11-09 22:01:19 -0800,23,70 -122,4847,2013-11-08 04:09:35 -0800,23,69 -123,4480,2013-11-12 10:13:45 -0800,24,73 -124,4636,2013-11-13 02:57:50 -0800,24,73 -125,3128,2013-11-08 06:34:47 -0800,25,74 -126,4221,2013-11-10 22:36:50 -0800,25,74 -127,5790,2013-11-08 06:20:42 -0800,25,74 -128,1143,2013-11-06 08:40:22 -0800,25,74 -129,1195,2013-11-10 10:40:40 -0800,25,74 -130,9173,2013-11-09 18:43:19 -0800,25,74 -131,4911,2013-11-12 05:43:19 -0800,25,74 -132,6509,2013-11-12 21:23:36 -0800,26,75 -133,1628,2013-11-12 18:37:47 -0800,26,77 -134,9088,2013-11-12 11:28:58 -0800,26,75 -135,1257,2013-11-07 21:05:27 -0800,26,76 -136,4694,2013-11-06 15:30:59 -0800,26,76 -137,4838,2013-11-12 09:10:10 -0800,26,75 -138,4112,2013-11-10 11:20:55 -0800,27,78 -139,294,2013-11-08 06:10:28 -0800,27,82 -140,2924,2013-11-09 22:17:00 -0800,27,80 -141,4589,2013-11-11 06:02:18 -0800,28,85 -142,3220,2013-11-08 01:28:06 -0800,29,87 -143,8521,2013-11-07 15:56:41 -0800,29,87 -144,9430,2013-11-10 03:24:10 -0800,29,88 -145,7916,2013-11-08 11:35:38 -0800,29,88 -146,4589,2013-11-08 12:53:02 -0800,29,87 -147,8111,2013-11-10 04:31:10 -0800,29,88 -148,7863,2013-11-13 04:29:57 -0800,29,86 -149,3091,2013-11-12 07:52:56 -0800,29,88 -150,717,2013-11-06 23:53:18 -0800,30,91 -151,5184,2013-11-07 12:32:39 -0800,30,89 -152,6377,2013-11-08 04:15:30 -0800,30,90 -153,3068,2013-11-08 12:03:41 -0800,30,89 -154,250,2013-11-12 14:25:06 -0800,30,89 -155,2515,2013-11-07 21:05:48 -0800,30,89 -156,6380,2013-11-12 19:11:50 -0800,30,91 -157,1159,2013-11-09 08:04:14 -0800,30,89 -158,5091,2013-11-11 01:40:51 -0800,31,94 -159,2264,2013-11-12 08:31:13 -0800,31,92 -160,2397,2013-11-09 23:32:57 -0800,31,92 -161,5435,2013-11-06 20:50:02 -0800,31,93 -162,3357,2013-11-09 05:29:45 -0800,32,97 -163,4371,2013-11-09 00:00:24 -0800,32,97 -164,3654,2013-11-08 01:40:32 -0800,33,103 -165,9646,2013-11-13 02:23:23 -0800,33,103 -166,4895,2013-11-09 14:56:25 -0800,33,102 -167,3590,2013-11-06 10:13:39 -0800,33,102 -168,4096,2013-11-07 03:33:58 -0800,33,101 -169,1814,2013-11-12 21:54:03 -0800,33,101 -170,2462,2013-11-13 07:03:27 -0800,33,101 -171,56,2013-11-11 20:40:32 -0800,33,103 -172,1710,2013-11-06 11:27:57 -0800,34,107 -173,4758,2013-11-09 21:51:17 -0800,34,107 -174,6619,2013-11-08 15:52:48 -0800,34,107 -175,5824,2013-11-07 21:51:51 -0800,34,105 -176,2091,2013-11-10 04:35:06 -0800,34,107 -177,2820,2013-11-09 16:45:19 -0800,34,106 -178,9558,2013-11-12 02:34:54 -0800,35,110 -179,2964,2013-11-12 00:39:14 -0800,35,111 -180,5870,2013-11-10 17:07:30 -0800,35,109 -181,9570,2013-11-06 19:04:38 -0800,35,111 -182,7443,2013-11-07 21:54:43 -0800,35,109 -183,6647,2013-11-08 09:51:36 -0800,35,112 -184,8787,2013-11-07 02:19:05 -0800,36,117 -185,1985,2013-11-13 07:49:09 -0800,37,118 -186,9242,2013-11-08 09:07:17 -0800,37,118 -187,821,2013-11-07 01:34:39 -0800,37,118 -188,44,2013-11-12 03:37:54 -0800,37,118 -189,7264,2013-11-11 08:53:44 -0800,38,122 -190,7070,2013-11-10 23:45:28 -0800,38,120 -191,2661,2013-11-09 07:22:39 -0800,38,123 -192,343,2013-11-11 17:16:11 -0800,38,119 -193,5893,2013-11-08 14:42:23 -0800,38,121 -194,8775,2013-11-07 04:14:21 -0800,38,121 -195,2259,2013-11-12 17:02:28 -0800,38,120 -196,8165,2013-11-12 04:22:55 -0800,38,120 -197,7878,2013-11-11 09:57:51 -0800,39,124 -198,9237,2013-11-07 08:17:20 -0800,39,126 -199,8435,2013-11-06 19:17:53 -0800,40,128 -200,8311,2013-11-12 03:21:43 -0800,40,128 -201,5438,2013-11-07 02:11:04 -0800,40,130 -202,4683,2013-11-08 20:18:25 -0800,40,131 -203,6675,2013-11-11 13:23:24 -0800,40,129 -204,2667,2013-11-12 01:29:25 -0800,40,127 -205,9298,2013-11-11 02:34:34 -0800,40,131 -206,6478,2013-11-08 05:16:16 -0800,40,131 -207,8142,2013-11-11 13:38:21 -0800,40,131 -208,3163,2013-11-09 15:14:14 -0800,41,135 -209,4710,2013-11-07 11:06:39 -0800,41,134 -210,3633,2013-11-10 16:05:19 -0800,41,133 -211,6890,2013-11-10 17:10:02 -0800,41,132 -212,3490,2013-11-09 01:00:25 -0800,42,139 -213,6470,2013-11-12 04:10:02 -0800,42,139 -214,1594,2013-11-10 00:30:40 -0800,43,141 -215,6498,2013-11-10 17:38:00 -0800,43,141 -216,5395,2013-11-08 18:05:00 -0800,43,144 -217,7730,2013-11-10 14:39:55 -0800,43,142 -218,2584,2013-11-09 12:03:56 -0800,43,143 -219,2450,2013-11-09 17:06:22 -0800,43,144 -220,7117,2013-11-09 13:30:02 -0800,44,146 -221,6370,2013-11-07 14:32:09 -0800,44,146 -222,8861,2013-11-09 10:37:07 -0800,44,145 -223,6622,2013-11-11 12:30:20 -0800,44,146 -224,8845,2013-11-12 01:50:28 -0800,44,146 -225,4990,2013-11-10 16:40:30 -0800,44,145 -226,6448,2013-11-10 23:53:41 -0800,44,145 -227,4050,2013-11-08 20:21:18 -0800,44,145 -228,9730,2013-11-08 05:44:39 -0800,45,149 -229,420,2013-11-08 05:31:35 -0800,45,147 -230,6014,2013-11-08 13:31:46 -0800,46,152 -231,4474,2013-11-06 17:58:22 -0800,46,153 -232,4126,2013-11-12 07:06:00 -0800,46,154 -233,6039,2013-11-06 21:39:13 -0800,46,152 -234,6180,2013-11-07 15:37:14 -0800,46,153 -235,2060,2013-11-07 10:10:36 -0800,47,156 -236,7097,2013-11-10 07:22:42 -0800,47,157 -237,8480,2013-11-08 01:57:37 -0800,47,156 -238,5465,2013-11-11 02:05:43 -0800,48,159 -239,8410,2013-11-13 07:46:50 -0800,48,158 -240,4094,2013-11-06 21:47:49 -0800,48,158 From 6e1a34631ca0e3fea3bf5ce9e64bdd9948826f34 Mon Sep 17 00:00:00 2001 From: noglows Date: Fri, 23 Oct 2015 15:04:01 -0700 Subject: [PATCH 32/35] Added most_revenue method to Vendor class --- To-Do.txt | 1 + lib/far_mar/sale.rb | 6 +++++- lib/far_mar/vendor.rb | 41 +++++++++++++++++++++++++++++-------- spec/far_mar/vendor_spec.rb | 24 ++++++++++++++-------- 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/To-Do.txt b/To-Do.txt index 95c7b77b..5ddbadde 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -4,3 +4,4 @@ # Rewrite tests to take test data # Investigate .nip # accomodate multiple best and worst vendors +# Make Product.most_revenue(n) work for the whole dataset diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index c5ea7395..93925dcc 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -11,9 +11,13 @@ def initialize(sale_hash) end # Returns a collection of Sale instances, representing all of the sales described in the CSV - def self.all(csv = "support/sales.csv") + def self.all(csv = "./support/sales.csv") # Only reload the CSV is sales is empty array @@sales ||= [] + # Checking that the array doesn't contain test data + if @@sales.length == 105 + @@sales = [] + end if @@sales == [] sales_csv = CSV.read(csv) sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 81c695ff..542ee73b 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -13,6 +13,10 @@ def initialize(vendor_hash) def self.all(csv = "support/vendors.csv") # Only reload the CSV if @vendors is empty array @@vendors ||= [] + # Checking that the array doesn't contain test data + if @@vendors.length == 48 + @@vendors = [] + end if @@vendors == [] vendors_csv = CSV.read(csv) vendors_csv.each do |id, name, num_employees, market_id| @@ -44,8 +48,8 @@ def products end # Returns a collection of FarMar::Sale instances that are associated with the vendor - def sales - sales = FarMar::Sale.all + def sales(csv = "./test_data/test_sales.csv") + sales = FarMar::Sale.all(csv) matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id} return matched_sales end @@ -68,13 +72,32 @@ def self.by_market(market_id) end # Returns the top n vendor instances ranked by total revenue - # def self.most_revenue(n) - # vendors = FarMar::Vendor.all - # if n < vendors.length - # max = vendors.max_by! { |vendor| vendor.revenue} - # return max - # end - # end + def self.most_revenue(n) + return_array = [] + @@sales = [] + @@vendors = [] + #vendors = FarMar::Vendor.all("./test_data/test_products.csv") + vendors = FarMar::Vendor.all("./test_data/test_vendors.csv") + + vendor_sales = Hash.new(0) + vendors.each do |vendor| + associated_sales = vendor.sales("./test_data/test_sales.csv") + #associated_sales = product.sales("./support/sales.csv") + revenue = 0 + associated_sales.each do |sale| + revenue += sale.amount + end + vendor_sales[vendor.vendor_id] = revenue + end + sorted = vendor_sales.sort_by { |vendor, rev| rev } + sorted.reverse! + best_vendors = sorted[0...n] + best_vendors.each do |vendor| + return_array.push(FarMar::Vendor.find(vendor[0])) + end + return return_array + end + end end diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index 2601c3f2..b7d939c6 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -90,12 +90,20 @@ end end - # describe ".most_revenue" do - # it "returns an array of n values" do - # number_of_vals = 3 - # expect(FarMar::Vendor.most_revenue(number_of_vals).length).to eq number_of_vals - # expect(FarMar::Vendor.most_revenue(number_of_vals)).to be_an_instance_of Array - # end - # end - + describe ".most_revenue" do + it "returns an array of length n" do + result = FarMar::Vendor.most_revenue(10) + expect(result.length).to eq 10 + expect(result).to be_an_instance_of Array + expect(result[0]).to be_an_instance_of FarMar::Vendor + end + it "returns the correct product for a test data set" do + expected_vendor_name = "Reynolds, Schmitt and Klocko" + result = FarMar::Vendor.most_revenue(10) + expect(result[0].vendor_name).to eq expected_vendor_name + end + end + + + end From 4031ff1ff3dbe7b30db47e390a7c20c344500713 Mon Sep 17 00:00:00 2001 From: noglows Date: Fri, 23 Oct 2015 15:33:47 -0700 Subject: [PATCH 33/35] Working most_items method for Vendor class --- lib/far_mar/sale.rb | 8 ++++---- lib/far_mar/vendor.rb | 35 ++++++++++++++++++++++++----------- spec/far_mar/vendor_spec.rb | 16 ++++++++++++++++ 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/lib/far_mar/sale.rb b/lib/far_mar/sale.rb index 93925dcc..49e7c265 100644 --- a/lib/far_mar/sale.rb +++ b/lib/far_mar/sale.rb @@ -14,10 +14,10 @@ def initialize(sale_hash) def self.all(csv = "./support/sales.csv") # Only reload the CSV is sales is empty array @@sales ||= [] - # Checking that the array doesn't contain test data - if @@sales.length == 105 - @@sales = [] - end + # Checking that the array doesn't contain test data - this seems to not be necessary + # if @@sales.length == 105 + # @@sales = [] + # end if @@sales == [] sales_csv = CSV.read(csv) sales_csv.each do |id, amount, purchase_time, vendor_id, product_id| diff --git a/lib/far_mar/vendor.rb b/lib/far_mar/vendor.rb index 542ee73b..7af88b00 100644 --- a/lib/far_mar/vendor.rb +++ b/lib/far_mar/vendor.rb @@ -10,7 +10,7 @@ def initialize(vendor_hash) end # Returns a collection of Vendor instances, representing all the vendors described in the CSV - def self.all(csv = "support/vendors.csv") + def self.all(csv = "./support/vendors.csv") # Only reload the CSV if @vendors is empty array @@vendors ||= [] # Checking that the array doesn't contain test data @@ -48,7 +48,7 @@ def products end # Returns a collection of FarMar::Sale instances that are associated with the vendor - def sales(csv = "./test_data/test_sales.csv") + def sales(csv = "./support/sales.csv") sales = FarMar::Sale.all(csv) matched_sales = sales.find_all { |sale| sale.vendor_id == self.vendor_id} return matched_sales @@ -72,22 +72,16 @@ def self.by_market(market_id) end # Returns the top n vendor instances ranked by total revenue + # Currently running on test data because the actual data takes a long time def self.most_revenue(n) return_array = [] @@sales = [] @@vendors = [] - #vendors = FarMar::Vendor.all("./test_data/test_products.csv") vendors = FarMar::Vendor.all("./test_data/test_vendors.csv") - + #vendors = FarMar::Vendor.all("./support/vendors.csv") vendor_sales = Hash.new(0) vendors.each do |vendor| - associated_sales = vendor.sales("./test_data/test_sales.csv") - #associated_sales = product.sales("./support/sales.csv") - revenue = 0 - associated_sales.each do |sale| - revenue += sale.amount - end - vendor_sales[vendor.vendor_id] = revenue + vendor_sales[vendor.vendor_id] = vendor.revenue end sorted = vendor_sales.sort_by { |vendor, rev| rev } sorted.reverse! @@ -98,6 +92,25 @@ def self.most_revenue(n) return return_array end + # Returns the top n vendor instances ranked by total number of items sold + def self.most_items(n, csv) + return_array = [] + @@sales = [] + @@vendors = [] + vendors = FarMar::Vendor.all(csv) + vendor_sales = Hash.new(0) + vendors.each do |vendor| + vendor_sales[vendor.vendor_id] = vendor.sales(csv).length + end + sorted = vendor_sales.sort_by { |vendor, num| num } + sorted.reverse! + best_vendors = sorted[0...n] + best_vendors.each do |vendor| + return_array.push(FarMar::Vendor.find(vendor[0])) + end + return return_array + end + end end diff --git a/spec/far_mar/vendor_spec.rb b/spec/far_mar/vendor_spec.rb index b7d939c6..62bc7e5e 100644 --- a/spec/far_mar/vendor_spec.rb +++ b/spec/far_mar/vendor_spec.rb @@ -104,6 +104,22 @@ end end + describe ".most_items" do + it "returns an array of length n" do + result = FarMar::Vendor.most_items(10, "./test_data/test_vendors.csv") + expect(result.length).to eq 10 + expect(result).to be_an_instance_of Array + expect(result[0]).to be_an_instance_of FarMar::Vendor + end + it "returns the correct product for a test data set" do + expected_vendor_name = "Dickens-Weissnat" + result = FarMar::Vendor.most_items(10, "./test_data/test_vendors.csv") + expect(result[0].vendor_name).to eq expected_vendor_name + end + it "restores sales to original data" do + expect(FarMar::Sale.all.length).to eq 12798 + end + end end From 023ae5de8010e90bf50d2c3d3e220cc6132413e8 Mon Sep 17 00:00:00 2001 From: noglows Date: Fri, 23 Oct 2015 15:41:23 -0700 Subject: [PATCH 34/35] Removed unnecessary files --- To-Do.txt | 2 + support/markets.csv | 500 -------------------------------------------- test.rb | 15 -- 3 files changed, 2 insertions(+), 515 deletions(-) delete mode 100644 support/markets.csv delete mode 100644 test.rb diff --git a/To-Do.txt b/To-Do.txt index 5ddbadde..2d2e70c1 100644 --- a/To-Do.txt +++ b/To-Do.txt @@ -5,3 +5,5 @@ # Investigate .nip # accomodate multiple best and worst vendors # Make Product.most_revenue(n) work for the whole dataset +# Make Vendor.most_revenue(n) work for the whole dataset +# Make Vendor.most_items(n) work for the whole dataset diff --git a/support/markets.csv b/support/markets.csv deleted file mode 100644 index 6a265cd0..00000000 --- a/support/markets.csv +++ /dev/null @@ -1,500 +0,0 @@ -1,People's Co-op Farmers Market,30th and Burnside,Portland,Multnomah,Oregon,97202 -2,Silverdale Farmers Market,98383,Silverdale,Kitsap,Washington,98383 -3,Dolgeville Farmer's Market,(Parking Lot) Between Main St. and Helmer Ave,Dolgeville,Herkimer,New York,13329 -4,Preston Farmers’ Market,#1 Route 164,Preston,New London,Connecticut, -5,Quincy Farmers Market,0 Denis Ryan Parkway,Quincy,Norfolk,Massachusetts,2169 -6,Jefferson City Farmer's Market,000 Main Street,Jefferson City,Cole,Missouri,0 -7,Petaluma Evening Farmers' Market,1 2nd Street,Petaluma,Sonoma,California,94952 -8,Charlestown Farmers Market,"1 Austin Street, Thompson Square at Austin & Main Streets",Boston,,Massachusetts,2129 -9,Farmers Market at Christopher Newport University,1 Avenue of the Arts,Newport News,Newport News,Virginia,23606 -10,Saratoga Farmers' Market,1 Bayberry Drive,Ballston Sp,Saratoga,New York,12020 -11,Charles Square,"1 Bennett Street,",Cambridge,Middlesex,Massachusetts,2138 -12,Coxsackie Farmers' Market,1 Betke Boulevard,Coxsackie,Greene,New York,12051 -13,Otsiningo Park Farmers' Market,1 Bevier St,Binghamton,Broome,New York,13905 -14,Hartford Farmers Market,1 Block North of Highway 60 on Rural Street,Hartford,Washington,Wisconsin,53027 -15,Farmers Market in Denison,1 block west of Main St.,Denison,,Texas,75090 -16,Riverside Farmers' Market,1 Burling Rd.,Riverside,Cook,Illinois,60546 -17,Farmers Market in Camdenton,1 Camden Ct NW,Camdenton,Camden,Missouri,65020 -18,Grand Valley State University Farmers Market,"1 Campus Drive, Parking Lot F",Allendale,Ottawa,Michigan,49504 -19,Ringwood Farmers' Market,1 Cannici Drive,Ringwood,Passaic,New Jersey,7456 -20,Scottdale Farmers Market,1 Centennial Way,Scottdale,Westmoreland,Pennsylvania,15683 -21,TRAVELERS REST COMMUNITY FARMERS MARKET,1 Center Street,Travelers Rest,Greenville,South Carolina,29690 -22,Medford Farmers Market,1 City Hall Mall,Medford,Middlesex,Massachusetts,2155 -23,Farmers Market on the Westford Common,1 Common Rd,Westford,,Vermont,5494 -24,Belington Farmers Market,1 County Highway 11,Belington,Barbour,West Virginia,25250 -25,Plaza Marketplace,1 Courthouse Square,Hillsboro,,Illinois,62049 -26,Cheyenne Farmers Market,1 Depot Plaza,Cheyenne,Laramie,Wyoming,82001 -27,Pinckneyville Farmers Market,1 E Water St.,Pinckneyville,Perry,Illinois,62274 -28,Skaneateles Farmers Market,1 East Austin Street,Skaneateles,Onondaga,New York,13152 -29,North Providence Farmers Market,1 Governor Notte Parkway off 1675 Douglas Avenue,North Providence,Providence,Rhode Island,2904 -30,Grafton Farmers Market,1 Grafton Common,Grafton,Worcester,Massachusetts,1519 -31,West Stockbridge Farmers Market,"1 Harris Street, Merritt Green",West Stockbridge,Berkshire,Massachusetts,1266 -32,North Quincy Farmers Market,"1 Heritage Drive, ING Parking Lot",Quincy,,Massachusetts,2171 -33,St. John's Church Farmers Market,1 Hudson Street,New York City,Westchester,New York,10701 -34,Historic Park Irvine,1 Irvine Park Rd.,City of irvine,Orange,California,92869 -35,Irvine Regional Park Certified Farmers' Market,1 Irvine Park Road,Orange,Orange,California, -36,Braintree Farmers Market,1 JFK Memorial Drive,Braintree,Norfolk,Massachusetts,2184 -37,Portsmouth Farmers' Market,1 Junkins Avenue,Portsmouth,,New Hampshire, -38,Atkinson NH Farmers Market,1 Kip Cam Road,Atkinson,Rockingham,New Hampshire,3811 -39,Gettysburg Farmers' Market,1 Lincoln Square,Gettysburg,Adams,Pennsylvania,17325 -40,Winooski Farmers' Market,1 Main St.,Winooski,Chittenden,Vermont,5404 -41,Woodbridge Farmers Market,"1 Main Street, Woodbridge",Woodbridge,Middlesex County,New Jersey, -42,Tuma’s Farmers Market,"1 mile east of Hot Springs, SD on Hwy 18",Hot Springs,Fall River County,South Dakota, -43,Waltham Farmers' Market,1 Moody Street,Waltham,Middlesex,Massachusetts,2454 -44,Ocala Farm Market,1 NE 1st Avenue,Ocala,Marion,Florida,34470 -45,Carbondale Farmers Market,1 North Main Street,Carbondale,Lackawanna,Pennsylvania,18407 -46,Farmers' Market at Mill Park,1 Northern Ave,Augusta,Kennebec,Maine,4330 -47,Harvard University Farmers' Market,1 Oxford Street,Cambridge,Middlesex,Massachusetts,2138 -48,Smart Markets Manassas Park,1 Park Center Ct.,Manassas Park,Prince William,Virginia,20111 -49,Acton-Boxborough Farmers Market,1 Pearl St,Acton,Middlesex,Massachusetts,1720 -50,Willoughby Outdoor Market,1 Public Square,Willoughby,Lake,Ohio,44094 -51,REC'S Mobile Farmers Market - YWCA of Central MA,1 Salem Square,Worcester,Worcester,Massachusetts, -52,Castine Farmers' Market,1 School St.,Castine,Hancock,Maine,4420 -53,"Lake Worth Farmer's Market, Waterside",1 South Ocean Blvd.,Lake Worth,,Florida,33460 -54,Crescent City Farmers Market,1 South Summit Street,Crescent City,Putnam,Florida,32112 -55,York Gateway Farmers' Market,1 Stonewall Lane,York,York,Maine,3909 -56,Carefree Farmers Market,1 Sundial Circle,Carefree,Maricopa,Arizona,85377 -57,Troy Waterfront Farmers Market,1 Third Street,Troy,Rensselaer,New York,12180 -58,Taylor Farmers' Market,1 Town Square Lane,Taylor,Lafayette,Mississippi,38673 -59,Heart of the City Farmers' Market,1 United Nations Plaza,San Francisco,San Francisco,California,94102 -60,North Asheville Tailgate Market,1 University Heights,Asheville,Buncombe,North Carolina,28804 -61,Winter Sun Farms Indoor Winter Market,1 Veteran Drive,New Paltz,Ulster,New York,12561 -62,New Lenox Farmers Market,1 Veterans Parkway,New Lenox,Will,Illinois,60451 -63,Sandhills Farmers Green Market,1 Village Green Rd West,Pinehurst,Moore,North Carolina,28374 -64,Oakmont Farmers Market,1 W Eagle Road,Havertown,Delaware,Pennsylvania,19083 -65,Kennedy Plaza Farmers Market,1 w. Chester Street,Long Beach,Nassau,New York,11561 -66,REAP Ellicottville Farmers Market,1 W. Washington Street,Ellicottville,Cattaraugus,New York,14731 -67,Forsyth Farmers' Market,1 West Park Avenue,Savannah,Chatham,Georgia,31401 -68,Northport Farmers Market,1 Woodbine Ave.,Northport,Suffolk,New York,11768 -69,Hollywood Market @ Young Circle,1 Young Circle,Hollywood,Broward,Florida,33022 -70,KC Organics and Natural Market,1/4 mile East of Holmes Road on Red Bridge Road,Kansas City,Jackson,Missouri,64114 -71,Towson Farmers' Market,10 Alleghany Avenue,Towson,Baltimore,Maryland,21204 -72,Thursday Marin Farmers Market,10 Avenue of the Flags,San Rafael,Marin,California,94903 -73,Deerfield Farmer's Market,10 Church Street,Deerfield,Rockingham,New Hampshire,3037 -74,Brick District Farmers' Market,10 East 5th Street,Fulton,Callaway,Missouri,65251 -75,Fox School Farmers Market,10 East Main Street,South Paris,Oxford,Maine,4281 -76,Ipswich Farmers Market,"10 Estes Street, Ebsco Parking Lot",Ipswich,,Massachusetts,1938 -77,Imperial Beach Certified Farmers Market,10 Evergreen Ave.(Pier Plaza),Imperial Beach,San Diego,California,91932 -78,Fresh Friday Farmers Market sponsored by Kaiser Permanente,10 Hopkins Plaza,Baltimore,Baltimore City,Maryland,21201 -79,Sugar Grove Farmers Market,10 Municipal Drive,Sugar Grove,,Illinois,60554 -80,Greater Danville Chamber of Commerce Farmer's Market,10 S Jefferson St.,Danville,Hendricks,Indiana,46122 -81,Charlemont,10 School St./Route 2,charlemont,Franklin,Massachusetts, -82,Kittery Community Market,10 Shapleigh RD,Kittery,York,Maine,3904 -83,Shillington Farmers market,10 South Summit Avenue,Shillington,Berks,Pennsylvania,19607 -84,King City Certified Farmers Market,100 & 200 Block of Broadway St.,King City,Monterey,California,93930 -85,Janesville Farmers Market,100 & 200 Blocks of Main Street,Janesville,Rock,Wisconsin,53545 -86,Valley Junction Farmers Market,100 & 200 blocks on 5th Street,West Des Moines,Polk,Iowa,50265 -87,Hayfield Farmer Market,100 2nd Street NE,Hayfield,Dodge,Minnesota,55940 -88,San Francisco Alemany Farmers Market,100 Alemany Boulevard,San Francisco,San Francisco,California,94110 -89,South Wedge Farmers Market,100 Alexander St.,Rochester,Monroe,New York,14620 -90,Kelso Bridge Market,100 Allen St. & Pacific Ave.,Kelso,Cowlitz,Washington,98626 -91,Downtown Cumberland,100 Baltimore Street,Cumberland,Allegany,Maryland,21502 -92,Richmond County Farmers Market,100 Biltmore Drive,Rockingham,Richmond,North Carolina,28379 -93,Mason Area Farmers Market,100 block East Maple at Jefferson (in street),Mason,Ingham,Michigan,48854 -94,Rome Farmers Market,100 block of East Dominick Street,Rome,Oneida,New York,13440 -95,Glendale Certified Farmers Market,100 Block of North Brand Boulevard,Glendale,Los Angeles,California,91206 -96,Mascoutah Farmers Market,100 block of railway,Mascoutah,,Illinois,62258 -97,Henry County Farmers Market,100 block of S Main Street,New Castle,Henry,Indiana,47632 -98,Charlotte DDA Farmers Market,100 block of West Harris St,Charlotte,Eaton,Michigan,48813 -99,State Center Farmers Market,100 block of West Main Street,State Center,Marshall,Iowa,50247 -100,Klamath Falls Farmers Market,100 block S 9th st.,Klamath Falls,Klamath,Oregon,97601 -101,Wharton County Farmers Market,100 Block South Houston Street,Wharton,Wharton,Texas,77488 -102,"Fredericksburg Farmers Market, Fredericksburg TX",100 block West Main Street,Fredericksburg,Gillespie,Texas,78624 -103,Vandenberg Village Farmers' Market,100 Burton Mesa blvd.,Lompoc,Santa Barbara,California,93436 -104,Boston City Hall Farmers Market,"100 Cambridge Street, City Hall Plaza",Boston,,Massachusetts,2129 -105,East Texas Fresh Farmers Market,100 Chimney Rock Drive,Tyler,Smith,Texas,75703 -106,Appleton Downtown Farm Market,100 College Avenue,Appleton,Outagamie,Wisconsin,54911 -107,Appleton Downtown Farm Market,"100 College Avenue, City Center Plaza",Appleton,Outagamie,Wisconsin,54911 -108,ABBEVILLE FARMERS MARKET,100 COLUMBIA RD.,ABBEVILLE,HENRY,Alabama,36310 -109,Gaylord Downtown Farmers Market,100 court st,gaylord,Otsego,Michigan,49735 -110,Gaylord West Farmers Market,100 Court Street,Gaylord,Otsego,Michigan,49735 -111,Davis County Farmers' Market,100 Courthouse Square,Bloomfield,Davis,Iowa,52537 -112,Canton Farmers Market,100 Depot Drive,Canton,Madison,Mississippi,39046 -113,Columbus Farmers' Market,100 Depot Street,Tryon,Polk,North Carolina, -114,Guadalupe Valley Gardener's Market,100 E Donegan,Seguin,Guadalupe,Texas,78155 -115,Middleville Farmers Market,100 E Main St,Middleville,Barry,Michigan,49333 -116,Grant County Farmer's Market,100 E Third St,Marion,Grant,Indiana,46952 -117,Urban Table Certified Farmer's Market,100 E. 4th Avenue,San Mateo,San Mateo County,California, -118,Downtown Valdosta Farm Days,100 E. Central Ave,Valdosta,Lowndes,Georgia,31601 -119,Davis County Farmers' Market,100 E. Jefferson St.,Bloomfield,Davis,Iowa,52537 -120,Redlands Farmers Market,100 E. Redlands Boulevard,Redlands,San Bernardino,California,92373 -121,Williamson Farmers Market,100 East 3rd Ave.,Williamson,Mingo,West Virginia,25661 -122,Visalia Farmers Markets,100 East King Ave.,Tulare,Tulare,California,93274 -123,High Desert Growers' Farmers' Market,100 East Main,Price,Carbon,Utah,84501 -124,Edible Saturdays Farmers Market,100 Green Meadows Drive,Lewis Center,Delaware,Ohio,43035 -125,Lenoir County Farmers Market,100 Herritage Street,Kinston,Lenoir,North Carolina,28501 -126,Farmers' Market of Laclede County,100 Hospital Drive,Lebanon,Laclede,Missouri,65536 -127,Columbus Farmers' Market,100 Irving Street,Saluda,Polk,North Carolina, -128,San Antonio Farmers Market Olmos Basin,100 Jackson Keller,San Antonio,Bexar,Texas,78216 -129,Ottawa Area Chamber of Commerce Farmers Market,100 Jackson Street,Ottawa,La Salle,Illinois,61350 -130,Woodstock Farmers Market,100 Johnson Street,woodstock,McHenry,Illinois,60098 -131,Capitan Farmers' Market,100 Lincoln Ave.,Capitan,Lincoln,New Mexico, -132,Johnson Farmers Market,100 Main Street,Johnson,Lamoille,Vermont,5656 -133,Lafayette County Farmers' Market - Odessa,100 Main Street,Odessa,Lafayette,Missouri,64076 -134,Red Bluff Saturday Farmers Market,100 Main Street,Red Bluff,Tehama,California,96080 -135,Manteca Certified Farmers Market,100 Manteca Avenue,Manteca,San Joaquin,California,95337 -136,Gadsden Farmers Market,100 Moragne Ave. Moragne Park,Gadsden,Etowah,Alabama,35902 -137,Lake Mary Farmers' Market,100 N 4th Street,Lake Mary,Seminole,Florida,32746 -138,Crisp! Garfield Park,100 N Central Park Ave.,Chicago,Cook,Illinois,60624 -139,Wauconda Farmers Market,100 N Main Street,Wauconda,Lake,Illinois,60084 -140,Henderson County Tailgate Market,100 N. King Street,Henderson,Henderson,Michigan,29739 -141,The Central Ozarks Farmers & Artisans Market,100 N. Main St.,Harrison,Boone,Arkansas,72601 -142,Wildwood Growers' Market,100 N. Main Street,Wildwood,Sumter,Florida,34785 -143,Macungie Farmers Market,100 N. Walnut Street,Macungie,Lehigh,Pennsylvania,18062 -144,Pompano Beach Green Market,100 N.E. First Street,Pompano Beach,Broward,Florida,33061 -145,Oakdale Certified Farmers Market,100 North 3Rd Avenue,OAKDALE,Stanislaus,California, -146,Elkhart Community Farmer's Market,100 North Elkhart Ave.,Elkhart,Elkhart,Indiana,46516 -147,Lake Mills Farmers' Market,100 North Main Street - Commons Park,Lake Mills,Jefferson,Wisconsin,53551 -148,Rockford City Market,100 North Water Street,Rockford,Winnebago,Illinois,61101 -149,SOMERSET FARMERS' MARKET,100 PUBLIC SQ.,SOMERSET,Perry,Ohio,43783 -150,Farmers Market in Christiansburg - NRV Grown,100 Radoford Street,Christiansburg,Montgomery,Virginia,24073 -151,Village of Denmark Farmers Market,100 Railroad Avenue,Denmark,Brown,Wisconsin,54208 -152,Stanly County Farmers Market,100 Railroad St,Albemarle,Stanly,North Carolina,28001 -153,Onslow County Farmers Market,100 Recreation Lane in The Commons,Jacksonville,Onslow,North Carolina,28546 -154,Ypsilanti Depot Town Farmers' Market,100 Rice Street (Market Place),Ypsilanti,Washtenaw,Michigan,48198 -155,Charles Town Farmers Market,100 S Samuel St,Charles Town,Jefferson,West Virginia,25414 -156,Santa Cruz River Farmers' Market,100 S. Avenida del Convento,Tucson,Pima,Arizona,85745 -157,Denton St. Luke's Farmers' Market,100 S. Fifth Avenue,Denton,Caroline,Maryland,21629 -158,Ruston Farmers Market,100 S. Monroe St.,Ruston,Lincoln,Louisiana,71270 -159,The Boyertown Farmers Market,100 S. Walnut Street,Boyertown,Berks,Pennsylvania,19512 -160,San Marcos/New Braunfels Farmers Market Association,100 San Antonio st,San Marcos,Hays,Texas,78666 -161,Bramwell Farmers' Market,100 simmons ave,Bramwell,Mercer,West Virginia,24715 -162,El Reno Farmers Market,100 South Choctaw Ave.,El Reno,Canadian,Oklahoma,73036 -163,Willits CFM,100 State St,Willits,Mendocino,California,95490 -164,Liberty Farmers Market,100 Sullivan Avenue,Ferndale,Sullivan,New York,12734 -165,Glade Spring Farmers Market,100 Town Square St,Glade Spring,Washington,Virginia,24340 -166,Nevada City Farmers Market,100 Union Street,Nevada City,Nevada,California,95959 -167,Uptown Normal Trailside Farmers Market,100 W North St,Normal,McLean,Illinois,61761 -168,Rensselaer Farmers Market,100 W. Harrison St.,Rensselaer,Jasper,Indiana,47978 -169,La Grange Farmers' Market & Artisans,100 W. Main Street,La Grange,Oldham,Kentucky,40031 -170,Monroe County Farmers Market-Waterloo IL,100 W. Mill St.,Waterloo,Randolph,Illinois,62298 -171,Moab Farmers' Market,100 West and Park Drive,Moab,Grand,Utah,84532 -172,Independence Farmers Market,100 West First Street,Independence,Buchanan,Iowa,50644 -173,El Pueblo Farmers' Market,100 West Irvington Road,Tucson,Pima,Arizona,85714 -174,Tri-County Farmers Market Association,100 West Main,San Antonio,Bexar County,Texas, -175,Clayton Farm and Community Market,100 West Main Street,Clayton,Johnston,North Carolina,27520 -176,Vine Grove Farmers Market,100 West main Street,Vine Grove,Hardin,Kentucky,40175 -177,Vineyard Farmers Market,100 West Shaw,Fresno,Fresno,California,93704 -178,BFR/Oyate Teca Farmers Market,100 Youth Center Drive,Kyle,Shannon,South Dakota,57752 -179,Farmers Market on Broadway,100-200 Blocks North Broadway,Green Bay,Brown,Wisconsin,54303 -180,Moon Farmers Market,1000 Beaver Grade Road,Moon Township,Allegheny,Pennsylvania,15108 -181,"Town of West Point, Virginia",1000 Chelsea Road,West Point,King William,Virginia,23181 -182,The Serbian Sun Market,1000 Colliers Way,Weirton,,West Virginia,26062 -183,Athens Farmers Market,1000 East State Street,Athens,Athens,Ohio,45701 -184,Stamford - High RidgeFarmers' Market,1000 High Ridge Road,Stamford,Fairfield,Connecticut,6901 -185,OSDH Wellness Farmers' Market,1000 NE 10th Street,Oklahoma City,Oklahoma County,Oklahoma, -186,Ballston Farmers Market,1000 North Glebe Road,Arlington,,Virginia,22207 -187,Cooper-Young Community Farmers Market,1000 S Cooper St,Memphis,Shelby,Tennessee,38104 -188,scalp ave farmers market,1000 scalp ave,Johnstown,Cambria,Pennsylvania,15904 -189,SLC People's Market,1000 South 900 West,SALT LAKE CITY,Salt Lake,Utah,84110 -190,Flossmoor Farmers Market,1000 Sterling Ave,Flossmoor,Cook,Illinois,60422 -191,Strite's Orchard Farm Market and Bakery,1000 Strites Road,Harrisburg,,Pennsylvania,17111 -192,Ocean Springs Fresh Market,1000 Washington Ave.,Ocean Springs,Jackson,Mississippi,39564 -193,Elk Grove Village Farmers Market,1000 Wellington Ave.,Elk Grove Village,Cook,Illinois,60007 -194,Farmers Market of Pueblo,1000 West 6th Street,Pueblo,,Colorado, -195,Douglass Farmers' Market,1000 West Paterson Street,Kalamazoo,Kalamazoo,Michigan,49007 -196,Volcano Farmers Market,"1000 Wright Road, Cooper Center",Volcano,Hawaii,Hawaii,96785 -197,Warson Woods Farmers' Market,10001 Manchester Road,Warson Woods,St. Louis,Missouri,63122 -198,Marion Farmers Market,1001 7th Avenue,Marion,Linn,Iowa,52302 -199,Show Low Main Street Farmers' Market & Art Walk,1001 E. Duece of Clubs,Show Low,Navajo,Arizona,85901 -200,Fort Collins Farmers Market,1001 East Harmony Road,Fort Collins,Larimer,Colorado,80525 -201,San Bernardino Farmers Market,1001 Highland Avenue,San Bernardino,San Bernardino,California,92413 -202,DePere Market at Festival Foods,1001 Main Ave,De Pere,Brown,Wisconsin, -203,The Osage Mercado,1001 Osage Street,Denver,Denver,Colorado,80204 -204,Scarsdale Farmers Market,1001 Post Rd.,North White Plains,Westchester,New York,10603 -205,Charlestown Farmers Market,1001 Ryan Street,Lake Charles,Calcasieu,Louisiana,70601 -206,Elko Farmers' Market,10012 Hwy. 78,Elko,Barnwell,South Carolina,29826 -207,West Frankfort Farmers Market,1002 E Cleveland St,West Frankfort,,Illinois,62896 -208,Springs Farm Farmers Market,1002 Springfield Parkway,Fort Mill,York,South Carolina,29715 -209,Fountain Farmers Market - First United Methodist Church,1003 North Santa Fe,Fountain,El Paso,Colorado,80817 -210,Montgomery Curb Market,1004 Madison Avenue,Montgomery,Montgomery,Alabama,36104 -211,De Soto Farmers' Market,1004 Rock Road,De Soto,Jefferson,Missouri,63020 -212,Wintertime Farmers Market,1005 Main Street,Pawtucket,Providence,Rhode Island,2860 -213,Munster's Farmer's Market,1005 N Centennial Dr.,Munster,Lake,Indiana,46321 -214,Espanola Farmers Market,1005 N.Railroad Avenue,Espanola,Rio Arriba,New Mexico,87532 -215,Boone County Farmers' Market,1005 W Worley St,Columbia,Boone,Missouri,65202 -216,Gay Hill Farmer's Market,10050 Highway 36 North,Brenham,Washington,Texas,77833 -217,Battlefield Farmers Market,10052 Hwy. 27 N.,Rock Spring,Walker,Georgia,30739 -218,Mt. Vernon Farmers Market,1006 E. Fourth St.,Mt. Vernon,Posey,Indiana,47620 -219,Rocky Mount Farmers Market,1006 Peachtree St.,Rocky Mount,Nash,North Carolina,27804 -220,Phoenix Hill NuLu Farmers' Market,1007 E. Jefferson St.,Louisville,Jefferson,Kentucky,40206 -221,Coushatta Farmers' Market,1007 Main Street,Elton,Jefferson Davis,Louisiana,70532 -222,Hatton Farmers Market,1009 Dakota Ave.,,,North Dakota, -223,East Jerusalem Fresh Food on the Block Farmers Market,1009 Rebecca Ave.,Hattiesburg,Forrest,Mississippi,39401 -224,Alliance for the Arts GreenMarket,10091 McGregor Boulevard,Ft. Myers,Lee,Florida,33919 -225,Berkshire - Rome Vendors' Market,101 block West Dominick,Rome,Oneida,New York,13440 -226,Buckwalters Farmers Market,101 Buckwalter Place,Bluffton,Beaufort,South Carolina,29910 -227,Carousel Sunday Market and Festival,101 Carousel Drive,Missoula,Missoula,Montana,59802 -228,Green Earth Farmers Market,101 Church Street at the Beach,Ottumwa,Wapello,Iowa,52501 -229,Chaparral Farmers' Market,101 County Line,Chaparral,Dona Ana,New Mexico, -230,Garden City Farmers Market,"101 County Seat Dr, off Old Country Rd, behind Supreme Court Bldg",Garden City,Nassau,New York, -231,Shreveport Farmers' Market,101 Crockett St.,Shreveport,Caddo,Louisiana,71101 -232,Downtown Kaukauna Farmer's Market,101 Crooks Ave.,Kaukauna,Outagamie,Wisconsin,54130 -233,Fayette County Farmers Market,101 E East Street,Washington Court House,Fayette,Ohio,43160 -234,Farmers Market at the Depot,101 E. Depot Street,Springfield,Washington,Kentucky,40069 -235,Red River Farmers Market,101 E. Hatton Road,Wichita Falls,Wichita,Texas,76302 -236,Mount Joy Farmers Market,101 E. Main Street,Mount Joy,Lancaster,Pennsylvania,17552 -237,Oxford Original Farmers Market,101 East Chestnut Street,Oxford,Butler,Ohio,45056 -238,Kennett Square Farmer's Market,101 East State Street,Kennett Square,Chester,Pennsylvania,19348 -239,St. Luke's SteelStacks Farmers Market,101 Founders Way,Bethlehem,Northampton,Pennsylvania,18015 -240,Cheraw Farmers Market,101 Front Street,Cheraw,Chesterfield,South Carolina,29520 -241,Bondurant Farmers Market,101 Grant Street N,Bondurant,,Iowa,50035 -242,St. Michaels FRESHFARM Market,101 Green Street,St. Michaels,Talbot,Maryland,21663 -243,Centreville Farmers' Market,101 Lawyers Row,Centreville,Queen Anne's,Maryland,21617 -244,Cooperstown Farmers' Market,"101 Main Street, PO Box 1130",Cooperstown,Otsego,New York,13326 -245,Hobart Farmers' Market,101 Maple Avenue,Hobart,Delaware,New York,13788 -246,Marinwood Community Farmers Market,101 Marinwood Avenue,San Rafael,Marin,California,94903 -247,"Downtown Farmers' Market of Fort Pierce, Inc.",101 Melody Lane,fort pierce,St. Lucie,Florida,34950 -248,Mendon Farmers Market,101 Mendon Ionia Road,Mendon,Monroe,New York,14506 -249,Swain County Tailgate Market,101 Mitchell St.,Bryson City,Swain,North Carolina,28713 -250,Greene County Farmers Market,101 N Chestnut Stree,Jefferson,Greene,Iowa,50129 -251,Cobb Market,101 N Wilson Street,Cobb,Iowa,Wisconsin, -252,Celina Farmers' Market,"101 N. Main Street, Courthouse Square",Celina,,Ohio,45822 -253,Main Street Market of Carrolton,101 North Main Street,Carrolton,Carroll,Missouri,64633 -254,Bounty of the Barrens Farmers' Market,101 North Public Square,Glasgow,Barren,Kentucky,42141 -255,Dundas Farmers Market,101 Railway St S,Dundas,Rice,Minnesota,55019 -256,Center City Green Market,101 S Tryon St,Charlotte,Mecklenburg,North Carolina,28202 -257,Farmers' Friday Market,101 S. Kerbey,Cave Junction,Josephine,Oregon, -258,Green Valley Farmers Market,101 S. La Canada Ste. 16,Green Valley,Pima,Arizona,85614 -259,Downtown Bloomington Farmers Market,101 S. Madison,Bloomington,McLean,Illinois,61701 -260,The Great Sidney Farmers Market,101 S. Ohio Avenue - Floor 2,Sidney,Shelby,Ohio,45365 -261,Evening Farmer's Market on the Riverwalk,101 S. Union Ave,Pueblo,Pueblo,Colorado,81003 -262,Uptown Wadesboro Farmers Market,101 South Greene Street,Wadesboro,Anson,North Carolina,28170 -263,Waxahachie Downtown Farmers Market,101 W. Main Street,Waxahachie,Ellis,Texas,75165 -264,Fayetteville Farmers Market on the Downtown Square,101 W. Mountain,Fayetteville,Washington,Arkansas,72701 -265,Orting Valley Farmers Market,101 Washington,Orting,Pierce,Washington,98360 -266,Harvest Home Metropolitan Avenue Market,101-15 Metropolitan Avenue,Queens,Queens,New York, -267,Chapman Food & Fitness Festival,1010 Cleveland Avenue,Chico,Butte,California,95928 -268,West End Senior Center Wednesday Farmer's Market,1010 Main Street,Buhl,Twin Falls,Idaho,83316 -269,Dallas Farmers Market,1010 S. Pearl Expressway,Dallas,Dallas,Texas,75201 -270,Upper State Street Farm Market,1010 State St,New Haven,,Connecticut,6511 -271,Farmboat - Floating Markets & Maritime Heritage Events,1010 Valley Street,Seattle,,Washington,98109 -272,Vallco Farmers' Market,10101 N. Wolfe Rd.,Cupertino,Santa Clara,California,95014 -273,Abbotsford Farmers Market,1011 East Spruce St.,Abbotsford,Clark,Wisconsin,54405 -274,DeSoto Farmers' Market,10117 Hwy. 171,Grand Cane,De Soto,Louisiana,71032 -275,Glens Falls Farmers Market Association,1012 State Route 9,Queensbury,Warren,New York,12804 -276,Stone Gardens Farmers' Market,1012 Straits Rd.,New Hampton,Belknap,New Hampshire,3256 -277,Allamakee Farmers Market,1013 Rossville Road,Waukon,Allamakee,Iowa,52172 -278,Priest River Farmer's and Flea Market,1015 Aleni Hwy,Priest River,Bonner,Idaho,83856 -279,jackie moreno city Waco,1015 Hogan Lane appt. 6,Waco,McLennan,Texas,76705 -280,Sulphur Farmers Market,1015 South Ruth St.,Sulphur,Calcasieu,Louisiana,70664 -281,Findlay Farmers Market,1017 E Sandusky St,Findlay,,Ohio,45840 -282,OLD MILLSTREAM FARMERS' MARKET,1017 E. SANDUSKY ST.- Hancock County Fairgrounds,FINDLAY,Hancock County,Ohio, -283,Hardin County Farmers Garden Trade Day,1019 Clifton Rd.,Savannah,Hardin,Tennessee,38372 -284,Fountain Inn Farmers Market,102 Depot Street,Fountain Inn,Greenville,South Carolina,29644 -285,Wapakoneta Farmers' Market,102 East Auglaize St.,Wapakoneta,Auglaize,Ohio,45895 -286,Round Top Farmers Market Association,102 Main Street,Round Top,Fayette,Texas,78954 -287,Evansville Farmers Market,102 Maple St.,Evansville,Rock,Wisconsin,53536 -288,hauppauge farmers market,102 motor parway,Hauppauge,Suffolk,New York,11787 -289,Northport Farmers Market,102 N Rose Street,Northport,Leelanau,Michigan,49670 -290,Growers Market of Fuquay-Varina,102 N. Main St.,Fuquay-Varina,Wake,North Carolina,27526 -291,Vincennes Historic Farmers Market,102 N. Second St.,Vincennes,Knox,Indiana,47591 -292,Alva Farmers Market,102 North 2d,Alva,Woods,Oklahoma,73717 -293,Danbury Farmers Market,102 Old Church Road,Danbury,Stokes,North Carolina,27016 -294,Petersburg' Farmers Market,102 S. 7th St.,Petersburg,Menard,Illinois,62675 -295,"Downtown Sylvester Farmers Market, INC.",102 S. Main Street,Sylvester,Worth,Georgia,31791 -296,Fallbrook Certified Farmers Market,102 S. Main Street,Fallbrook,San Diego,California,92028 -297,Forest Farmer's Market,102 W. Lima St.,Forest,Hardin,Ohio,45843 -298,Huning Street Farmers and Artisan Market,1020 E. Huning,Show Low,Navajo,Arizona,85901 -299,The Farmers Market at Clear Lake Shores,1020 Marina Bay Drive,Clear Lake Shores,Galveston,Texas,77565 -300,Chino Valley Farmers Market,1020 N. State Road 89,Chino Valley,Yavapai,Arizona,86323 -301,Southwest Farmers Market,10200 Dixie Highway,Louisville,Jefferson,Kentucky,40272 -302,Farmers' Market at Poplar Grove,10200 US Hwy 17,Wilmington,Pender,North Carolina,28411 -303,Madison County Farmers Market,1022 Cook Avenue,Huntsville,Madison,Alabama,35804 -304,Ohio Valley Fruit & Vegetable Growers Asociation,1025 Lila Avenue,Milford,Clermont,Ohio,45150 -305,Clayton California Farmers' Market,1028 Diablo Street,Clayton,Contra Costa,California,94517 -306,Grant County Farmer's Market,1028 E Main St,Gas City,Grant,Indiana,46933 -307,"Webster's Joe Obbie Farmers' Market, Inc.","1028 Ridge Road, Webster Towne Center",Webster,Monroe,New York,14580 -308,Whistle Stop Park Farmers Market,103 4th St NE,Dilworth,Clay,Minnesota,56529 -309,The Montalvo House Community Market,103 E. Thomas Street,Brackettville,Kinney,Texas,78832 -310,The Pass Market,103 Fleitas Ave.,Pass Christian,Harrison,Mississippi,39571 -311,Blair Farmers Market,103 South 12th Street,Blair,Washington,Nebraska,68008 -312,Farmington Farmers Market,103 South Front St.,Farmington,Van Buren,Iowa,52626 -313,South Maple Street Farmers Market,103 South Maple Avenue,Davenport,Thayer,Nebraska,68335 -314,Bracken County Farmers Market II,103 West 2nd Street,Augusta,Bracken,Kentucky,41002 -315,Okanogan Valley Farmers Market,1030 2nd Ave. N,Okanogan,Okanogan,Washington,98840 -316,Organic Farmers Market at Hoovers,1035 Academy Drive,Altamonte Springs,Seminole,Florida,32714 -317,Scripps Ranch Farmers Market & Family Festival,10380 Spring Canyon Rd.,San Diego,San Diego,California,92131 -318,King George Farmers' Market,10381 Ridge Road,King George,King George,Virginia,22485 -319,D'Iberville Farmers Market,10383 Automall Parkway,D'Iberville,Harrison,Mississippi,39540 -320,San Marcos/New Braunfels Farmers Market Association,104 C.M. Allen Parkway,San Marcos,Hays,Texas,78666 -321,Coopers Cove Farmers Market,104 E. Avenue D,Lampasas,Lampasas,Texas,79045 -322,Main Street Elyria Farmers Market,104 Middle Ave.,Elyria,,Ohio,44035 -323,REC's Community Farmers Market - Fuller Family Park,104 Murray Ave.,Worcester,Worcester,Massachusetts,1610 -324,Chariton Farmers Market,104 N. Grand,Chariton,Lucas,Iowa,50049 -325,Haskell County Farmers Market,104 Northeast 6th St.,Stigler,Haskell,Oklahoma,74462 -326,Grand Rapids Farmers Market,104 NW 4th St,Grand Rapids,Itasca,Minnesota,55744 -327,Winter Garden Farmers' Market,104 S. Lakeview Ave,Winter Garden,Orange,Florida, -328,Oberlin Farmers Market,104 S. Penn St.,Oberlin,Decatur,Kansas,67749 -329,Eatonville Farmers Market,104 Washington Street,Eatonville,Pierce,Washington,98328 -330,True Value Patterson FM,1040 W. Las Palmas,Patterson,Stanislaus,California, -331,St. Charles Farmers' Market,10400 O’Donnell Place,St. Charles,Charles,Maryland,20603 -332,Desert Canyon Center Farmers Market,10405 McDowell Mountain Rd.,Scottsdale,Maricopa,Arizona,85250 -333,Chilton Farmers Market,1041 E. Chestnut St,Chilton,Calumet,Wisconsin,53014 -334,"Meade County Farmers Market, Inc",1041 Old Ekron Rd.,Brandenburg,Meade,Kentucky,40108 -335,Dover Cove Farmers' Market,1041 South St,Dover-Foxcroft,Piscataquis,Maine,4426 -336,Greene County Farmers Market,10415 Spotswood Trail,Stanardsville,Greene,Virginia,22973 -337,Jeffersontown Farmers Market,10416 Watterson Trail,Jeffersontown,Jefferson,Kentucky,40299 -338,Feed Mill's Farmer's Market,10494 Wisconsin Avenue,Hayward,Sawyer,Wisconsin,54843 -339,Northglenn Mall Farmers market,104th & I-25 Northglenn Mall,Northglenn,Adams,Colorado,80035 -340,Harvest Home Union Settlement Market,104th St and 3rd Ave,Manhattan,New York,New York, -341,East Harlem Farmer's Market,104th Street & 3rd Avenue,New York,New York,New York,10029 -342,Bay County Farmers Market,105 Adams St,Bay City,Bay,Michigan,48708 -343,Crystal City Farmers' Market,105 Bailley Rd.,Crystal City,Jefferson,Missouri,63019 -344,Jonesborough Farmers Market,105 Courthouse Square,Jonesborough,Washington,Tennessee,37659 -345,Downtown Daytona Beach Farmers Market,105 E. Magnolia Ave.,Daytona Beach,Volusia,Florida,32114 -346,Prairie Township Natural Products,105 Kern Road,Middletown,Montgomery,Missouri,63359 -347,Coteau Hills Farmers' Market,105 Main Ave South,Kulm,,North Dakota,58456 -348,King Farmers Market,105 Moore Road,King,Stokes,North Carolina,27021 -349,International City Farmers' Market,105 Mulberry St (Perkins Field),Warner Robins,Houston,Georgia,31093 -350,Columbus Downtown Farmer's Market,105 N. Dickason Blvd,Columbus,Columbia,Wisconsin,53925 -351,Jerseyville Farmers' & Artisan Market,105 N. Liberty Street,Jerseyville,Jersey,Illinois,62052 -352,NEW LEXINGTON FARMERS' MARKET,105 N. MAIN ST.,NEW LEXINGTON,Perry,Ohio, -353,Plainfield Chamber Farmers' Market,105 S. East Street,Plainfield,Hendricks,Indiana,46168 -354,Granville Corners Fruit & Vegetable Growers Association,105 Tupelo Circle,Oxford,Granville,North Carolina,27565 -355,Harvest with a Heart,105 W. Emeline Street,Milford,,Indiana,46542 -356,Historic Longview Farmers Market,105 West Cotton Street,Longview,Gregg,Texas,75605 -357,Del Mar Farmers Market,1050 Camino Del Mar,Del Mar,Tulare,California,92014 -358,Dansville Farmers' Market,1050 Dakin St.,Dansville,Ingham,Michigan,48819 -359,REC's Mobile Farmers Market - Webster Square Towers (WHA),1050 Main Street,Worcester,Worcester,Massachusetts,1610 -360,Crisp! Auburn Gresham,1050 W 79th St.,Chicago,Cook,Illinois,60620 -361,Stoughton Farmers Market,1050 W. Main Street,Stoughton,Dane,Wisconsin,53589 -362,Palm Beach Gardens GreenMarket,10500 North Military Trail,Palm Beach Gardens,Palm Beach,Florida,33410 -363,Fairfax Community Farmers' Market,10500 Page Avenue,Fairfax,Fairfax City,Virginia, -364,Fairfax Sunday Farmers Market,10500 Page Avenue,Fairfax,Fairfax City,Virginia,22030 -365,San Diego Mira Mesa Farmers Market,10510 Reagan Road,San Diego,San Diego,California,92126 -366,Akers of Strawberries,1054 Melton Rd.,Baker,Okaloosa,Florida,32531 -367,Full Circle Farm Stand,1055 Dunford Way,Sunnyvale,Santa Clara,California,94087 -368,Rosendale Farmers Market,1055 Rt.32,Rosendale,Ulster,New York,12472 -369,The Heritage Harvest Certified Farmers Market,10570 Foothill Boulevard CA,Rancho Cucamonga,San Bernardino,California,91730 -370,Twin City Farmers Market,106 Avenue A,Sterling IL,Whiteside,Illinois,61081 -371,Catonsville Farmers Market,106 Bloomsbury Ave,Catonsville,Baltimore,Maryland,20913 -372,The Cumming Harvest,"106 Colony Park Drive, Suite 100",Cumming,Forsyth,Georgia,30040 -373,Market Place On Broadway,106 East Broadway,Ardmore,Carter,Oklahoma,73401 -374,CONCORD MARKET,"106 East Jackson Rd (M-60),",Concord,Jackson,Michigan,49237 -375,Eden Street Market,106 Eden Street,Davidson,,North Carolina, -376,Tazewell Farmers Market,106 Gratton Rd,Tazewell,Tazewell,Virginia,24651 -377,coyote farm and home market,106 Maple,ashland,Boone,Missouri,65010 -378,Village Market Cooperative,106 N MARKET STREET (BEHIND THE PUBLIC LIBRARY),Rockville,Parke County,Indiana, -379,Darby Farmers Market,106 S Main Street,Darby,Ravalli,Montana,59829 -380,OLD GREGG SCHOOL FARMERS MARKET,106 School Street,Spring Mills,Centre County,Pennsylvania, -381,The Villa Rica Farmers Market @ The Mill,106 Temple Street,Villa Rica,Carroll,Georgia,30180 -382,Kingwood Farmers Market,106 W Main Street,Kingwood,Preston,West Virginia,26537 -383,Farm 2 Family Brunswick Friday Farmers Market,10600 Bubling Wells Rd,Grass Valley,Nevada,California,95945 -384,Mandarin Farmers Market by the Whole Foods Market,10601 San Jose Boulevard,Jacksonville,Duval,Florida,32259 -385,Chisago City Farmers Market,10656 Railroad Avenue,Chisago City,Chisago,Minnesota,55013 -386,Community Farmers Market at Brookland Baptist Church,1066 Sunset Blvd.,West Columbia,Richland,South Carolina,29169 -387,Main Street Statesboro Farmers Market,106c. Savannah Ave,Statesboro,Bulloch,Georgia,30458 -388,Deposit Farmers' Market,107 2nd Street,Deposit,Delaware,New York,13754 -389,Hopkinton Farmers Market,107 Beech Hill Road,Hopkinton,Merrimack,New Hampshire,3229 -390,HERITAGE PARK MARKET,107 COMER HALL,AUBURN UNIVERSITY,LEE,Alabama,36849 -391,Arenac Conservation District Farmers Market,107 N Main Street,Standish,Arenac,Michigan,48658 -392,Emporia Farmers Market,107 South Main Street,Emporia,Emporia,Virginia,23847 -393,Nacogdoches Farmers' Market,107 W. Pearl Street,Nacogdoches,Nacogdoches,Texas,75961 -394,Downtown Hays Market,107 West 10th St.,Hays,,Kansas,67601 -395,Steeleville Farmers Market,107 West Broadway,Steeleville,Randolph,Illinois,62288 -396,Gulfport Harbor Market,1070 23rd Ave.,Gulfport,Harrison,Mississippi,39501 -397,Green Market at Piedmont Park,1071 Piedmont Ave NE,Atlanta,Fulton,Georgia,30309 -398,Mid Del Farmers' Market,10713 East Reno,Midwest City,Oklahoma,Oklahoma,73130 -399,Golden Mile Farmers Market,10744 Back Mountain Road,Milroy,Mifflin,Pennsylvania,17063 -400,Green Spring Station Farmers Market,10751 Falls Road,Baltimore,Baltimore,Maryland,21212 -401,Jay Village Farmers' Market,1077 Vermont Route 242,Jay,,Vermont,5859 -402,Grand Court Farmers' Market,107th Street and Wornall Road,Kansas City,Jackson,Missouri,64137 -403,Ashe County Farmers Market,108 Backstreet,West Jefferson,Ashe,North Carolina,28694 -404,Smyrna Farmers Market,108 David Collins Drive,Smyrna,Rutherford County,Tennessee, -405,Hip Donelson Community Farmers Market,108 Donelson Pike,Nashville,,Tennessee,37214 -406,Edmonson County Farmers’ Market,108 Ferguson Street,Brownsville,Edmonson,Kentucky, -407,Boaz Farmers Market,108 Line Street,Boaz,Marshall,Alabama,35957 -408,Carver Farmers' Market,108 Main St.,Carver,Plymouth,Massachusetts,2330 -409,Rec Park Farmers Market,108 Montgomery Ave.,Lewistown,Mifflin,Pennsylvania,17044 -410,Idabel Farmers Market,108 North Central Main Street,Idabel,McCurtain,Oklahoma,74745 -411,Wichita County Farmers' Market,108 S. 4th Street,Leoti,Wichita,Kansas,67861 -412,Chilhowee Main Street Farmers' Market,108 S. Main St.,Chilhowee,Johnson,Missouri,64733 -413,Blacksburg Farmers Market,"108 W Roanoke St, Suite 101",Blacksburg,Montgomery,Virginia,24060 -414,Rockmart Farmers' Market,108 Water St.,Rockmart,,Georgia,30153 -415,Selma/Dallas County Farmers Market,108 West Dallas Avenue,Selma,Dallas,Alabama,36701 -416,Clawson Farmers Market,1080 N Custer,Clawson,Oakland,Michigan,48017 -417,The Boise Farmers Market,1080 W. Front Street,Boise,Ada,Idaho,83701 -418,Sassy Pea Market/Good Earth Petting Farm (at The Good Earth Day School),10820 East Crystal Falls Parkway,Leander,,Texas,78641 -419,"Conover Farmers Market, Inc",109 1st Street East,Conover,Catawba,North Carolina,28613 -420,Ralph H. Johnson Medical Center Farmers Market,109 Bee St.,Charleston,Charleston,South Carolina,29401 -421,Enid Farmers Market,109 E. Garriott Road,Enid,Garfield,Oklahoma,73703 -422,Homer Farmers Market,109 East Leigh street (M-60),Homer,Calhoun,Michigan,49245 -423,Broadway Farmers Market,109 North Main Street,Broadway,,Virginia,22815 -424,Coventry Farmers Market,109 North Road,,Chenango,New York, -425,New Britain Farmers Market,109 North Street,New Britain,Hartford,Connecticut,6051 -426,Local Farmers Market at the Shoppes at the Flight Deck in Lexington,109 Old Chapin Rd.,Lexington,Lexington,South Carolina,29072 -427,Clifton Farmers Market,109 S Scribner St,Clifton,Washington,Kansas,66937 -428,Downtown Farmerington Farmers Market,109 Spruce Street,Framington,Dakota,Minnesota,55024 -429,Cortez Farmers Market,109 W Main Street,Cortez,Montezuma,Colorado,81321 -430,Farmers Market at Latham UMC,109 Weatherly Road,Huntsville,,Alabama,35803 -431,Freedom Farmers Market,10905 Livingston Road,Fort Washington,Prince George's,Maryland,20744 -432,Bloomingrove Produce Auction,1091 Free Rd,Shiloh,Richland,Ohio,44878 -433,Whitehouse Farmers' Market,10911 Toledo Street,Whitehouse,Lucas,Ohio,43571 -434,The Cornerstone Market,1095 Allen Road,Greenville,Pitt,North Carolina,27834 -435,Walt L. Shamel Community Farmers Market(on Dean Street),1095 Dean Street,Brooklyn,New York,New York,11216 -436,New Gloucester Community Market,1095 Lewiston Rd. (Rt. 100),New Gloucester,Cumberland,Maine,4260 -437,The Boise Farmers Market,10th & Grove St.,Boise,Ada,Idaho,83701 -438,Cheyenne County Farmers Market,10th & Jackson Street,Sidney,Cheyenne,Nebraska,69162 -439,Downtown Topeka Farmers Market,10th & Topeka Blvd.,Topeka,Shawnee,Kansas,66618 -440,Cool Spring Farmers Market,10th and Jackson Street,Wilmington,New Castle,Delaware,19805 -441,Brookland Farmers Market,"10th and Otis Streets, NE",District of Columbia,District of Columbia,District of Columbia, -442,Capitol Midweek Farmers' Market,10th Ave. & Jackson Street,Topeka,Shawnee,Kansas,66612 -443,Golden Farmers Market,10th Avenue & Illinois Street,Golden,Jefferson,Colorado,80401 -444,Myrtle's Market (Myrtle Beach Farmers Market),10th Avenue & Oak Street,Myrtle Beach,Horry,South Carolina,29578 -445,Rendezvous Region Langdon Farmers Market,10th Avenue and 3rd Street,Langdon,Cavalier,North Dakota,58249 -446,Sacramento Chavez Plaza Certified Farmers' Market,10th St and J St,Sacramento,Sacramento,California,95814 -447,Collinsville Farmers Market,10th St. & Center,Collinsville,Tulsa,Oklahoma,74021 -448,Downtown Tracy Certified Farmers Market,10th Street,Tracy,San Joaquin,California,95376 -449,Fortuna Farmers Market,10th Street & L,Scotia,Humboldt,California,95518 -450,Sunblest,10Th Street Modesto,Modesto,Stanislaus,California, -451,REC's Mobile Farmers Market - Lincoln Towers (WHA),11 Lake Ave.,Worcester,Worcester,Massachusetts,1610 -452,North Amherst Winter Farmers' Market,11 Meadow St.,Leverett,Hampshire,Massachusetts,1054 -453,Martin's Farmstand,11 Needham Rd.,Potsdam,St. Lawrence,New York, -454,Stonington Farmers Market,"11 Northwest Street, Town Dock",Stonington,New London,Connecticut,6378 -455,Penacook Village Farmers' Market,11 Penacook St.,Penacook,Merrimack,New Hampshire,3303 -456,Morgan County Farmers' Market,11 W Carlisle Street,Mooresville,Morgan,Indiana,46158 -457,"Blue Moon Acres Farm Market- Pennington, NJ",11 Willow Creek Dr.,Pennington,,New Jersey,8534 -458,Local Farmers Market,110 1st Street E.,Park Rapids,Hubbard,Minnesota,56470 -459,West Frederick Farmers' Market,110 Baughman's Lane,Frederick,Frederick,Maryland,21701 -460,Cape Charles Farmers Market,110 Blue Heaven Rd.,Cape Charles,,Virginia,23310 -461,Cape Charles Farmers Market,110 Blue Heaven Rd.,Cape Charles,,Virginia,23310 -462,Johnson County Farmers Market,110 Court St.,Mountain City,Johnson,Tennessee,37683 -463,Talent Evening Market,110 E Main St,Talent,Jackson,Oregon,97540 -464,North Umpqua Farmers and Artisans Regional Marketplace (NUFARM),110 East B. Avenue,Drain,Douglas County,Oregon, -465,Lenny's Farmers market,110 North Hampton Street,Americus,Sumter,Georgia,31709 -466,Giles County Farmers Market,110 North Second Street,Pulaski,Giles,Tennessee,38478 -467,Gravette Farmers' Market,110 Park Drive,Gravette,Benton,Arkansas,72736 -468,Rogue River SUnday Market,110 Pine Street,Rogue RIver,Jackson,Oregon,97537 -469,historic lewes farmers market,110 Shipcarpenter Street,Lewes,,Delaware,19958 -470,historic lewes farmers market,110 Shipcarpenter Street,Lewes,Sussex,Delaware,19958 -471,Santa Barbara La Cumbre Farmers Market,110 South Hope Avenue,Santa Barbara,Santa Barbara,California,93101 -472,Howard County Farmers Market,110 South Washington Street,Nashville,Howard,Arkansas,71852 -473,Corvallis Indoor Winter Market,110 SW 53rd St,Corvallis,Benton,Oregon,97333 -474,Warren Farmers Market,110 W Main St.,Warren,,Illinois,61087 -475,Hopkinsville-Christian County Downtown Farmers Market,110 West 9th Street,Hopkinsville,Christian,Kentucky,42240 -476,Keller Farmers Market,1100 Bear Creek Parkway,Keller,Tarrant,Texas,76244 -477,Hollywood Media Farmers Market,1100 Block of Cole Ave.,Hollister,Los Angeles,California,95023 -478,Radford Farmers Market,1100 block of East Main Street,Radford,Bedford,Virginia,24141 -479,Zerns Farmers Market and Auction,1100 E. Philadelphia Ave,Gilbertsville,Montgomery,Pennsylvania,19525 -480,Prescott Farmers Market,1100 E. Sheldon Street,Prescott,Yavapai,Arizona,86301 -481,Great Mall CFM,1100 Great Mall Drive,Milipitas,Santa Clara,California,95035 -482,New Richmond Farmers Market,1100 Heritage Drive,New Richmond,St. Croix,Wisconsin,54017 -483,South Milwaukee Downtown Market,1100 Milwaukee Avenue,South Milwaukee,Milwaukee,Wisconsin,53172 -484,Bellingham Farmers Market,1100 Railroad Avenue,Bellinhgam,Whatcom,Washington,98225 -485,Trinity Episcopal Church Farmers Market,1100 Sumter Street,Columbia,Richland,South Carolina,29201 -486,Tuacahn Saturday Market,1100 Tuacahn Drive,Ivins,Washington,Utah,84738 -487,Huntsville Downtown Farmers Market,1100 University Avenue,Huntsville,Walker,Texas,77340 -488,Tucson Farmers' Market at Oro Valley,11000 N. La Canada Blvd.,Oro Valley,Pima,Arizona,85737 -489,Pinecrest Gardens Farmers Market,11000 SW 57th Avenue,Pinecrest,Miami-Dade,Florida,33156 -490,Dubuque Winter Farmers Market,1101 Central Ave,Dubuque,Dubuque,Iowa,52001 -491,Mosinee Farmers Market,1101 Main Street,City,Marathon,Wisconsin,54455 -492,Gardens Summer GreenMarket at STORE,11010 North Military Trail,Palm Beach Gardens,Palm Beach,Florida,33410 -493,Woodstock Farmers Market,1102 McConnell Road,woodstock,McHenry,Illinois,60098 -494,Northside Farmers' Market - Youngstown,1105 Elm Street,Youngstown,Mahoning,Ohio,44505 -495,South Bend Farmers Market,1105 Northside Blvd.,South Bend,St. Joseph,Indiana,46615 -496,City of Perry Farmers Market,1106 Meeting Street,Perry,Houston,Georgia,31069 -497,Nevada County Farmers Market,11078 West First Street North,Prescott,Nevada,Arkansas,71857 -498,Morningside Park Farmers Market,110th Street & Manhattan Avenue,Mornignside Heights,New York,New York,10027 -499,Fletcher Allen's Farmers' Market,111 Colchester Ave 204 EN3,Burlington,Chittenden,Vermont,5401 -500,Montefiore Medical Center Farmers Market_Thursday,111 E. 210th Street,Bronx,Bronx,New York,10467 \ No newline at end of file diff --git a/test.rb b/test.rb deleted file mode 100644 index e804072d..00000000 --- a/test.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'date' - -#time = DateTime.parse('2013-11-07 00:00:00+00:00', '%Y-%m-%dT%H:%M:%S%z') -#test_time = DateTime.parse('2013-11-07 19:30:03 -0800', '%Y-%m-%dT%H:%M:%S%z') - -time = DateTime.parse('2013-11-07 00:00:00+00:00') -end_time = time+1 -test_time = DateTime.parse('2013-11-07 19:30:03 -0800') - -puts test_time.day >= time.day # expect true -puts test_time.day > end_time.day # expect false - -puts time -puts end_time -puts test_time From c3277d62609314c71ab4487974d28125eb4952f4 Mon Sep 17 00:00:00 2001 From: noglows Date: Fri, 23 Oct 2015 15:42:59 -0700 Subject: [PATCH 35/35] Restoring the markets.csv file I accidentally deleted --- support/markets.csv | 500 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 500 insertions(+) create mode 100644 support/markets.csv diff --git a/support/markets.csv b/support/markets.csv new file mode 100644 index 00000000..9633b6cf --- /dev/null +++ b/support/markets.csv @@ -0,0 +1,500 @@ +1,People's Co-op Farmers Market,30th and Burnside,Portland,Multnomah,Oregon,97202 +2,Silverdale Farmers Market,98383,Silverdale,Kitsap,Washington,98383 +3,Dolgeville Farmer's Market,(Parking Lot) Between Main St. and Helmer Ave,Dolgeville,Herkimer,New York,13329 +4,Preston Farmers’ Market,#1 Route 164,Preston,New London,Connecticut, +5,Quincy Farmers Market,0 Denis Ryan Parkway,Quincy,Norfolk,Massachusetts,2169 +6,Jefferson City Farmer's Market,000 Main Street,Jefferson City,Cole,Missouri,0 +7,Petaluma Evening Farmers' Market,1 2nd Street,Petaluma,Sonoma,California,94952 +8,Charlestown Farmers Market,"1 Austin Street, Thompson Square at Austin & Main Streets",Boston,,Massachusetts,2129 +9,Farmers Market at Christopher Newport University,1 Avenue of the Arts,Newport News,Newport News,Virginia,23606 +10,Saratoga Farmers' Market,1 Bayberry Drive,Ballston Sp,Saratoga,New York,12020 +11,Charles Square,"1 Bennett Street,",Cambridge,Middlesex,Massachusetts,2138 +12,Coxsackie Farmers' Market,1 Betke Boulevard,Coxsackie,Greene,New York,12051 +13,Otsiningo Park Farmers' Market,1 Bevier St,Binghamton,Broome,New York,13905 +14,Hartford Farmers Market,1 Block North of Highway 60 on Rural Street,Hartford,Washington,Wisconsin,53027 +15,Farmers Market in Denison,1 block west of Main St.,Denison,,Texas,75090 +16,Riverside Farmers' Market,1 Burling Rd.,Riverside,Cook,Illinois,60546 +17,Farmers Market in Camdenton,1 Camden Ct NW,Camdenton,Camden,Missouri,65020 +18,Grand Valley State University Farmers Market,"1 Campus Drive, Parking Lot F",Allendale,Ottawa,Michigan,49504 +19,Ringwood Farmers' Market,1 Cannici Drive,Ringwood,Passaic,New Jersey,7456 +20,Scottdale Farmers Market,1 Centennial Way,Scottdale,Westmoreland,Pennsylvania,15683 +21,TRAVELERS REST COMMUNITY FARMERS MARKET,1 Center Street,Travelers Rest,Greenville,South Carolina,29690 +22,Medford Farmers Market,1 City Hall Mall,Medford,Middlesex,Massachusetts,2155 +23,Farmers Market on the Westford Common,1 Common Rd,Westford,,Vermont,5494 +24,Belington Farmers Market,1 County Highway 11,Belington,Barbour,West Virginia,25250 +25,Plaza Marketplace,1 Courthouse Square,Hillsboro,,Illinois,62049 +26,Cheyenne Farmers Market,1 Depot Plaza,Cheyenne,Laramie,Wyoming,82001 +27,Pinckneyville Farmers Market,1 E Water St.,Pinckneyville,Perry,Illinois,62274 +28,Skaneateles Farmers Market,1 East Austin Street,Skaneateles,Onondaga,New York,13152 +29,North Providence Farmers Market,1 Governor Notte Parkway off 1675 Douglas Avenue,North Providence,Providence,Rhode Island,2904 +30,Grafton Farmers Market,1 Grafton Common,Grafton,Worcester,Massachusetts,1519 +31,West Stockbridge Farmers Market,"1 Harris Street, Merritt Green",West Stockbridge,Berkshire,Massachusetts,1266 +32,North Quincy Farmers Market,"1 Heritage Drive, ING Parking Lot",Quincy,,Massachusetts,2171 +33,St. John's Church Farmers Market,1 Hudson Street,New York City,Westchester,New York,10701 +34,Historic Park Irvine,1 Irvine Park Rd.,City of irvine,Orange,California,92869 +35,Irvine Regional Park Certified Farmers' Market,1 Irvine Park Road,Orange,Orange,California, +36,Braintree Farmers Market,1 JFK Memorial Drive,Braintree,Norfolk,Massachusetts,2184 +37,Portsmouth Farmers' Market,1 Junkins Avenue,Portsmouth,,New Hampshire, +38,Atkinson NH Farmers Market,1 Kip Cam Road,Atkinson,Rockingham,New Hampshire,3811 +39,Gettysburg Farmers' Market,1 Lincoln Square,Gettysburg,Adams,Pennsylvania,17325 +40,Winooski Farmers' Market,1 Main St.,Winooski,Chittenden,Vermont,5404 +41,Woodbridge Farmers Market,"1 Main Street, Woodbridge",Woodbridge,Middlesex County,New Jersey, +42,Tuma’s Farmers Market,"1 mile east of Hot Springs, SD on Hwy 18",Hot Springs,Fall River County,South Dakota, +43,Waltham Farmers' Market,1 Moody Street,Waltham,Middlesex,Massachusetts,2454 +44,Ocala Farm Market,1 NE 1st Avenue,Ocala,Marion,Florida,34470 +45,Carbondale Farmers Market,1 North Main Street,Carbondale,Lackawanna,Pennsylvania,18407 +46,Farmers' Market at Mill Park,1 Northern Ave,Augusta,Kennebec,Maine,4330 +47,Harvard University Farmers' Market,1 Oxford Street,Cambridge,Middlesex,Massachusetts,2138 +48,Smart Markets Manassas Park,1 Park Center Ct.,Manassas Park,Prince William,Virginia,20111 +49,Acton-Boxborough Farmers Market,1 Pearl St,Acton,Middlesex,Massachusetts,1720 +50,Willoughby Outdoor Market,1 Public Square,Willoughby,Lake,Ohio,44094 +51,REC'S Mobile Farmers Market - YWCA of Central MA,1 Salem Square,Worcester,Worcester,Massachusetts, +52,Castine Farmers' Market,1 School St.,Castine,Hancock,Maine,4420 +53,"Lake Worth Farmer's Market, Waterside",1 South Ocean Blvd.,Lake Worth,,Florida,33460 +54,Crescent City Farmers Market,1 South Summit Street,Crescent City,Putnam,Florida,32112 +55,York Gateway Farmers' Market,1 Stonewall Lane,York,York,Maine,3909 +56,Carefree Farmers Market,1 Sundial Circle,Carefree,Maricopa,Arizona,85377 +57,Troy Waterfront Farmers Market,1 Third Street,Troy,Rensselaer,New York,12180 +58,Taylor Farmers' Market,1 Town Square Lane,Taylor,Lafayette,Mississippi,38673 +59,Heart of the City Farmers' Market,1 United Nations Plaza,San Francisco,San Francisco,California,94102 +60,North Asheville Tailgate Market,1 University Heights,Asheville,Buncombe,North Carolina,28804 +61,Winter Sun Farms Indoor Winter Market,1 Veteran Drive,New Paltz,Ulster,New York,12561 +62,New Lenox Farmers Market,1 Veterans Parkway,New Lenox,Will,Illinois,60451 +63,Sandhills Farmers Green Market,1 Village Green Rd West,Pinehurst,Moore,North Carolina,28374 +64,Oakmont Farmers Market,1 W Eagle Road,Havertown,Delaware,Pennsylvania,19083 +65,Kennedy Plaza Farmers Market,1 w. Chester Street,Long Beach,Nassau,New York,11561 +66,REAP Ellicottville Farmers Market,1 W. Washington Street,Ellicottville,Cattaraugus,New York,14731 +67,Forsyth Farmers' Market,1 West Park Avenue,Savannah,Chatham,Georgia,31401 +68,Northport Farmers Market,1 Woodbine Ave.,Northport,Suffolk,New York,11768 +69,Hollywood Market @ Young Circle,1 Young Circle,Hollywood,Broward,Florida,33022 +70,KC Organics and Natural Market,1/4 mile East of Holmes Road on Red Bridge Road,Kansas City,Jackson,Missouri,64114 +71,Towson Farmers' Market,10 Alleghany Avenue,Towson,Baltimore,Maryland,21204 +72,Thursday Marin Farmers Market,10 Avenue of the Flags,San Rafael,Marin,California,94903 +73,Deerfield Farmer's Market,10 Church Street,Deerfield,Rockingham,New Hampshire,3037 +74,Brick District Farmers' Market,10 East 5th Street,Fulton,Callaway,Missouri,65251 +75,Fox School Farmers Market,10 East Main Street,South Paris,Oxford,Maine,4281 +76,Ipswich Farmers Market,"10 Estes Street, Ebsco Parking Lot",Ipswich,,Massachusetts,1938 +77,Imperial Beach Certified Farmers Market,10 Evergreen Ave.(Pier Plaza),Imperial Beach,San Diego,California,91932 +78,Fresh Friday Farmers Market sponsored by Kaiser Permanente,10 Hopkins Plaza,Baltimore,Baltimore City,Maryland,21201 +79,Sugar Grove Farmers Market,10 Municipal Drive,Sugar Grove,,Illinois,60554 +80,Greater Danville Chamber of Commerce Farmer's Market,10 S Jefferson St.,Danville,Hendricks,Indiana,46122 +81,Charlemont,10 School St./Route 2,charlemont,Franklin,Massachusetts, +82,Kittery Community Market,10 Shapleigh RD,Kittery,York,Maine,3904 +83,Shillington Farmers market,10 South Summit Avenue,Shillington,Berks,Pennsylvania,19607 +84,King City Certified Farmers Market,100 & 200 Block of Broadway St.,King City,Monterey,California,93930 +85,Janesville Farmers Market,100 & 200 Blocks of Main Street,Janesville,Rock,Wisconsin,53545 +86,Valley Junction Farmers Market,100 & 200 blocks on 5th Street,West Des Moines,Polk,Iowa,50265 +87,Hayfield Farmer Market,100 2nd Street NE,Hayfield,Dodge,Minnesota,55940 +88,San Francisco Alemany Farmers Market,100 Alemany Boulevard,San Francisco,San Francisco,California,94110 +89,South Wedge Farmers Market,100 Alexander St.,Rochester,Monroe,New York,14620 +90,Kelso Bridge Market,100 Allen St. & Pacific Ave.,Kelso,Cowlitz,Washington,98626 +91,Downtown Cumberland,100 Baltimore Street,Cumberland,Allegany,Maryland,21502 +92,Richmond County Farmers Market,100 Biltmore Drive,Rockingham,Richmond,North Carolina,28379 +93,Mason Area Farmers Market,100 block East Maple at Jefferson (in street),Mason,Ingham,Michigan,48854 +94,Rome Farmers Market,100 block of East Dominick Street,Rome,Oneida,New York,13440 +95,Glendale Certified Farmers Market,100 Block of North Brand Boulevard,Glendale,Los Angeles,California,91206 +96,Mascoutah Farmers Market,100 block of railway,Mascoutah,,Illinois,62258 +97,Henry County Farmers Market,100 block of S Main Street,New Castle,Henry,Indiana,47632 +98,Charlotte DDA Farmers Market,100 block of West Harris St,Charlotte,Eaton,Michigan,48813 +99,State Center Farmers Market,100 block of West Main Street,State Center,Marshall,Iowa,50247 +100,Klamath Falls Farmers Market,100 block S 9th st.,Klamath Falls,Klamath,Oregon,97601 +101,Wharton County Farmers Market,100 Block South Houston Street,Wharton,Wharton,Texas,77488 +102,"Fredericksburg Farmers Market, Fredericksburg TX",100 block West Main Street,Fredericksburg,Gillespie,Texas,78624 +103,Vandenberg Village Farmers' Market,100 Burton Mesa blvd.,Lompoc,Santa Barbara,California,93436 +104,Boston City Hall Farmers Market,"100 Cambridge Street, City Hall Plaza",Boston,,Massachusetts,2129 +105,East Texas Fresh Farmers Market,100 Chimney Rock Drive,Tyler,Smith,Texas,75703 +106,Appleton Downtown Farm Market,100 College Avenue,Appleton,Outagamie,Wisconsin,54911 +107,Appleton Downtown Farm Market,"100 College Avenue, City Center Plaza",Appleton,Outagamie,Wisconsin,54911 +108,ABBEVILLE FARMERS MARKET,100 COLUMBIA RD.,ABBEVILLE,HENRY,Alabama,36310 +109,Gaylord Downtown Farmers Market,100 court st,gaylord,Otsego,Michigan,49735 +110,Gaylord West Farmers Market,100 Court Street,Gaylord,Otsego,Michigan,49735 +111,Davis County Farmers' Market,100 Courthouse Square,Bloomfield,Davis,Iowa,52537 +112,Canton Farmers Market,100 Depot Drive,Canton,Madison,Mississippi,39046 +113,Columbus Farmers' Market,100 Depot Street,Tryon,Polk,North Carolina, +114,Guadalupe Valley Gardener's Market,100 E Donegan,Seguin,Guadalupe,Texas,78155 +115,Middleville Farmers Market,100 E Main St,Middleville,Barry,Michigan,49333 +116,Grant County Farmer's Market,100 E Third St,Marion,Grant,Indiana,46952 +117,Urban Table Certified Farmer's Market,100 E. 4th Avenue,San Mateo,San Mateo County,California, +118,Downtown Valdosta Farm Days,100 E. Central Ave,Valdosta,Lowndes,Georgia,31601 +119,Davis County Farmers' Market,100 E. Jefferson St.,Bloomfield,Davis,Iowa,52537 +120,Redlands Farmers Market,100 E. Redlands Boulevard,Redlands,San Bernardino,California,92373 +121,Williamson Farmers Market,100 East 3rd Ave.,Williamson,Mingo,West Virginia,25661 +122,Visalia Farmers Markets,100 East King Ave.,Tulare,Tulare,California,93274 +123,High Desert Growers' Farmers' Market,100 East Main,Price,Carbon,Utah,84501 +124,Edible Saturdays Farmers Market,100 Green Meadows Drive,Lewis Center,Delaware,Ohio,43035 +125,Lenoir County Farmers Market,100 Herritage Street,Kinston,Lenoir,North Carolina,28501 +126,Farmers' Market of Laclede County,100 Hospital Drive,Lebanon,Laclede,Missouri,65536 +127,Columbus Farmers' Market,100 Irving Street,Saluda,Polk,North Carolina, +128,San Antonio Farmers Market Olmos Basin,100 Jackson Keller,San Antonio,Bexar,Texas,78216 +129,Ottawa Area Chamber of Commerce Farmers Market,100 Jackson Street,Ottawa,La Salle,Illinois,61350 +130,Woodstock Farmers Market,100 Johnson Street,woodstock,McHenry,Illinois,60098 +131,Capitan Farmers' Market,100 Lincoln Ave.,Capitan,Lincoln,New Mexico, +132,Johnson Farmers Market,100 Main Street,Johnson,Lamoille,Vermont,5656 +133,Lafayette County Farmers' Market - Odessa,100 Main Street,Odessa,Lafayette,Missouri,64076 +134,Red Bluff Saturday Farmers Market,100 Main Street,Red Bluff,Tehama,California,96080 +135,Manteca Certified Farmers Market,100 Manteca Avenue,Manteca,San Joaquin,California,95337 +136,Gadsden Farmers Market,100 Moragne Ave. Moragne Park,Gadsden,Etowah,Alabama,35902 +137,Lake Mary Farmers' Market,100 N 4th Street,Lake Mary,Seminole,Florida,32746 +138,Crisp! Garfield Park,100 N Central Park Ave.,Chicago,Cook,Illinois,60624 +139,Wauconda Farmers Market,100 N Main Street,Wauconda,Lake,Illinois,60084 +140,Henderson County Tailgate Market,100 N. King Street,Henderson,Henderson,Michigan,29739 +141,The Central Ozarks Farmers & Artisans Market,100 N. Main St.,Harrison,Boone,Arkansas,72601 +142,Wildwood Growers' Market,100 N. Main Street,Wildwood,Sumter,Florida,34785 +143,Macungie Farmers Market,100 N. Walnut Street,Macungie,Lehigh,Pennsylvania,18062 +144,Pompano Beach Green Market,100 N.E. First Street,Pompano Beach,Broward,Florida,33061 +145,Oakdale Certified Farmers Market,100 North 3Rd Avenue,OAKDALE,Stanislaus,California, +146,Elkhart Community Farmer's Market,100 North Elkhart Ave.,Elkhart,Elkhart,Indiana,46516 +147,Lake Mills Farmers' Market,100 North Main Street - Commons Park,Lake Mills,Jefferson,Wisconsin,53551 +148,Rockford City Market,100 North Water Street,Rockford,Winnebago,Illinois,61101 +149,SOMERSET FARMERS' MARKET,100 PUBLIC SQ.,SOMERSET,Perry,Ohio,43783 +150,Farmers Market in Christiansburg - NRV Grown,100 Radoford Street,Christiansburg,Montgomery,Virginia,24073 +151,Village of Denmark Farmers Market,100 Railroad Avenue,Denmark,Brown,Wisconsin,54208 +152,Stanly County Farmers Market,100 Railroad St,Albemarle,Stanly,North Carolina,28001 +153,Onslow County Farmers Market,100 Recreation Lane in The Commons,Jacksonville,Onslow,North Carolina,28546 +154,Ypsilanti Depot Town Farmers' Market,100 Rice Street (Market Place),Ypsilanti,Washtenaw,Michigan,48198 +155,Charles Town Farmers Market,100 S Samuel St,Charles Town,Jefferson,West Virginia,25414 +156,Santa Cruz River Farmers' Market,100 S. Avenida del Convento,Tucson,Pima,Arizona,85745 +157,Denton St. Luke's Farmers' Market,100 S. Fifth Avenue,Denton,Caroline,Maryland,21629 +158,Ruston Farmers Market,100 S. Monroe St.,Ruston,Lincoln,Louisiana,71270 +159,The Boyertown Farmers Market,100 S. Walnut Street,Boyertown,Berks,Pennsylvania,19512 +160,San Marcos/New Braunfels Farmers Market Association,100 San Antonio st,San Marcos,Hays,Texas,78666 +161,Bramwell Farmers' Market,100 simmons ave,Bramwell,Mercer,West Virginia,24715 +162,El Reno Farmers Market,100 South Choctaw Ave.,El Reno,Canadian,Oklahoma,73036 +163,Willits CFM,100 State St,Willits,Mendocino,California,95490 +164,Liberty Farmers Market,100 Sullivan Avenue,Ferndale,Sullivan,New York,12734 +165,Glade Spring Farmers Market,100 Town Square St,Glade Spring,Washington,Virginia,24340 +166,Nevada City Farmers Market,100 Union Street,Nevada City,Nevada,California,95959 +167,Uptown Normal Trailside Farmers Market,100 W North St,Normal,McLean,Illinois,61761 +168,Rensselaer Farmers Market,100 W. Harrison St.,Rensselaer,Jasper,Indiana,47978 +169,La Grange Farmers' Market & Artisans,100 W. Main Street,La Grange,Oldham,Kentucky,40031 +170,Monroe County Farmers Market-Waterloo IL,100 W. Mill St.,Waterloo,Randolph,Illinois,62298 +171,Moab Farmers' Market,100 West and Park Drive,Moab,Grand,Utah,84532 +172,Independence Farmers Market,100 West First Street,Independence,Buchanan,Iowa,50644 +173,El Pueblo Farmers' Market,100 West Irvington Road,Tucson,Pima,Arizona,85714 +174,Tri-County Farmers Market Association,100 West Main,San Antonio,Bexar County,Texas, +175,Clayton Farm and Community Market,100 West Main Street,Clayton,Johnston,North Carolina,27520 +176,Vine Grove Farmers Market,100 West main Street,Vine Grove,Hardin,Kentucky,40175 +177,Vineyard Farmers Market,100 West Shaw,Fresno,Fresno,California,93704 +178,BFR/Oyate Teca Farmers Market,100 Youth Center Drive,Kyle,Shannon,South Dakota,57752 +179,Farmers Market on Broadway,100-200 Blocks North Broadway,Green Bay,Brown,Wisconsin,54303 +180,Moon Farmers Market,1000 Beaver Grade Road,Moon Township,Allegheny,Pennsylvania,15108 +181,"Town of West Point, Virginia",1000 Chelsea Road,West Point,King William,Virginia,23181 +182,The Serbian Sun Market,1000 Colliers Way,Weirton,,West Virginia,26062 +183,Athens Farmers Market,1000 East State Street,Athens,Athens,Ohio,45701 +184,Stamford - High RidgeFarmers' Market,1000 High Ridge Road,Stamford,Fairfield,Connecticut,6901 +185,OSDH Wellness Farmers' Market,1000 NE 10th Street,Oklahoma City,Oklahoma County,Oklahoma, +186,Ballston Farmers Market,1000 North Glebe Road,Arlington,,Virginia,22207 +187,Cooper-Young Community Farmers Market,1000 S Cooper St,Memphis,Shelby,Tennessee,38104 +188,scalp ave farmers market,1000 scalp ave,Johnstown,Cambria,Pennsylvania,15904 +189,SLC People's Market,1000 South 900 West,SALT LAKE CITY,Salt Lake,Utah,84110 +190,Flossmoor Farmers Market,1000 Sterling Ave,Flossmoor,Cook,Illinois,60422 +191,Strite's Orchard Farm Market and Bakery,1000 Strites Road,Harrisburg,,Pennsylvania,17111 +192,Ocean Springs Fresh Market,1000 Washington Ave.,Ocean Springs,Jackson,Mississippi,39564 +193,Elk Grove Village Farmers Market,1000 Wellington Ave.,Elk Grove Village,Cook,Illinois,60007 +194,Farmers Market of Pueblo,1000 West 6th Street,Pueblo,,Colorado, +195,Douglass Farmers' Market,1000 West Paterson Street,Kalamazoo,Kalamazoo,Michigan,49007 +196,Volcano Farmers Market,"1000 Wright Road, Cooper Center",Volcano,Hawaii,Hawaii,96785 +197,Warson Woods Farmers' Market,10001 Manchester Road,Warson Woods,St. Louis,Missouri,63122 +198,Marion Farmers Market,1001 7th Avenue,Marion,Linn,Iowa,52302 +199,Show Low Main Street Farmers' Market & Art Walk,1001 E. Duece of Clubs,Show Low,Navajo,Arizona,85901 +200,Fort Collins Farmers Market,1001 East Harmony Road,Fort Collins,Larimer,Colorado,80525 +201,San Bernardino Farmers Market,1001 Highland Avenue,San Bernardino,San Bernardino,California,92413 +202,DePere Market at Festival Foods,1001 Main Ave,De Pere,Brown,Wisconsin, +203,The Osage Mercado,1001 Osage Street,Denver,Denver,Colorado,80204 +204,Scarsdale Farmers Market,1001 Post Rd.,North White Plains,Westchester,New York,10603 +205,Charlestown Farmers Market,1001 Ryan Street,Lake Charles,Calcasieu,Louisiana,70601 +206,Elko Farmers' Market,10012 Hwy. 78,Elko,Barnwell,South Carolina,29826 +207,West Frankfort Farmers Market,1002 E Cleveland St,West Frankfort,,Illinois,62896 +208,Springs Farm Farmers Market,1002 Springfield Parkway,Fort Mill,York,South Carolina,29715 +209,Fountain Farmers Market - First United Methodist Church,1003 North Santa Fe,Fountain,El Paso,Colorado,80817 +210,Montgomery Curb Market,1004 Madison Avenue,Montgomery,Montgomery,Alabama,36104 +211,De Soto Farmers' Market,1004 Rock Road,De Soto,Jefferson,Missouri,63020 +212,Wintertime Farmers Market,1005 Main Street,Pawtucket,Providence,Rhode Island,2860 +213,Munster's Farmer's Market,1005 N Centennial Dr.,Munster,Lake,Indiana,46321 +214,Espanola Farmers Market,1005 N.Railroad Avenue,Espanola,Rio Arriba,New Mexico,87532 +215,Boone County Farmers' Market,1005 W Worley St,Columbia,Boone,Missouri,65202 +216,Gay Hill Farmer's Market,10050 Highway 36 North,Brenham,Washington,Texas,77833 +217,Battlefield Farmers Market,10052 Hwy. 27 N.,Rock Spring,Walker,Georgia,30739 +218,Mt. Vernon Farmers Market,1006 E. Fourth St.,Mt. Vernon,Posey,Indiana,47620 +219,Rocky Mount Farmers Market,1006 Peachtree St.,Rocky Mount,Nash,North Carolina,27804 +220,Phoenix Hill NuLu Farmers' Market,1007 E. Jefferson St.,Louisville,Jefferson,Kentucky,40206 +221,Coushatta Farmers' Market,1007 Main Street,Elton,Jefferson Davis,Louisiana,70532 +222,Hatton Farmers Market,1009 Dakota Ave.,,,North Dakota, +223,East Jerusalem Fresh Food on the Block Farmers Market,1009 Rebecca Ave.,Hattiesburg,Forrest,Mississippi,39401 +224,Alliance for the Arts GreenMarket,10091 McGregor Boulevard,Ft. Myers,Lee,Florida,33919 +225,Berkshire - Rome Vendors' Market,101 block West Dominick,Rome,Oneida,New York,13440 +226,Buckwalters Farmers Market,101 Buckwalter Place,Bluffton,Beaufort,South Carolina,29910 +227,Carousel Sunday Market and Festival,101 Carousel Drive,Missoula,Missoula,Montana,59802 +228,Green Earth Farmers Market,101 Church Street at the Beach,Ottumwa,Wapello,Iowa,52501 +229,Chaparral Farmers' Market,101 County Line,Chaparral,Dona Ana,New Mexico, +230,Garden City Farmers Market,"101 County Seat Dr, off Old Country Rd, behind Supreme Court Bldg",Garden City,Nassau,New York, +231,Shreveport Farmers' Market,101 Crockett St.,Shreveport,Caddo,Louisiana,71101 +232,Downtown Kaukauna Farmer's Market,101 Crooks Ave.,Kaukauna,Outagamie,Wisconsin,54130 +233,Fayette County Farmers Market,101 E East Street,Washington Court House,Fayette,Ohio,43160 +234,Farmers Market at the Depot,101 E. Depot Street,Springfield,Washington,Kentucky,40069 +235,Red River Farmers Market,101 E. Hatton Road,Wichita Falls,Wichita,Texas,76302 +236,Mount Joy Farmers Market,101 E. Main Street,Mount Joy,Lancaster,Pennsylvania,17552 +237,Oxford Original Farmers Market,101 East Chestnut Street,Oxford,Butler,Ohio,45056 +238,Kennett Square Farmer's Market,101 East State Street,Kennett Square,Chester,Pennsylvania,19348 +239,St. Luke's SteelStacks Farmers Market,101 Founders Way,Bethlehem,Northampton,Pennsylvania,18015 +240,Cheraw Farmers Market,101 Front Street,Cheraw,Chesterfield,South Carolina,29520 +241,Bondurant Farmers Market,101 Grant Street N,Bondurant,,Iowa,50035 +242,St. Michaels FRESHFARM Market,101 Green Street,St. Michaels,Talbot,Maryland,21663 +243,Centreville Farmers' Market,101 Lawyers Row,Centreville,Queen Anne's,Maryland,21617 +244,Cooperstown Farmers' Market,"101 Main Street, PO Box 1130",Cooperstown,Otsego,New York,13326 +245,Hobart Farmers' Market,101 Maple Avenue,Hobart,Delaware,New York,13788 +246,Marinwood Community Farmers Market,101 Marinwood Avenue,San Rafael,Marin,California,94903 +247,"Downtown Farmers' Market of Fort Pierce, Inc.",101 Melody Lane,fort pierce,St. Lucie,Florida,34950 +248,Mendon Farmers Market,101 Mendon Ionia Road,Mendon,Monroe,New York,14506 +249,Swain County Tailgate Market,101 Mitchell St.,Bryson City,Swain,North Carolina,28713 +250,Greene County Farmers Market,101 N Chestnut Stree,Jefferson,Greene,Iowa,50129 +251,Cobb Market,101 N Wilson Street,Cobb,Iowa,Wisconsin, +252,Celina Farmers' Market,"101 N. Main Street, Courthouse Square",Celina,,Ohio,45822 +253,Main Street Market of Carrolton,101 North Main Street,Carrolton,Carroll,Missouri,64633 +254,Bounty of the Barrens Farmers' Market,101 North Public Square,Glasgow,Barren,Kentucky,42141 +255,Dundas Farmers Market,101 Railway St S,Dundas,Rice,Minnesota,55019 +256,Center City Green Market,101 S Tryon St,Charlotte,Mecklenburg,North Carolina,28202 +257,Farmers' Friday Market,101 S. Kerbey,Cave Junction,Josephine,Oregon, +258,Green Valley Farmers Market,101 S. La Canada Ste. 16,Green Valley,Pima,Arizona,85614 +259,Downtown Bloomington Farmers Market,101 S. Madison,Bloomington,McLean,Illinois,61701 +260,The Great Sidney Farmers Market,101 S. Ohio Avenue - Floor 2,Sidney,Shelby,Ohio,45365 +261,Evening Farmer's Market on the Riverwalk,101 S. Union Ave,Pueblo,Pueblo,Colorado,81003 +262,Uptown Wadesboro Farmers Market,101 South Greene Street,Wadesboro,Anson,North Carolina,28170 +263,Waxahachie Downtown Farmers Market,101 W. Main Street,Waxahachie,Ellis,Texas,75165 +264,Fayetteville Farmers Market on the Downtown Square,101 W. Mountain,Fayetteville,Washington,Arkansas,72701 +265,Orting Valley Farmers Market,101 Washington,Orting,Pierce,Washington,98360 +266,Harvest Home Metropolitan Avenue Market,101-15 Metropolitan Avenue,Queens,Queens,New York, +267,Chapman Food & Fitness Festival,1010 Cleveland Avenue,Chico,Butte,California,95928 +268,West End Senior Center Wednesday Farmer's Market,1010 Main Street,Buhl,Twin Falls,Idaho,83316 +269,Dallas Farmers Market,1010 S. Pearl Expressway,Dallas,Dallas,Texas,75201 +270,Upper State Street Farm Market,1010 State St,New Haven,,Connecticut,6511 +271,Farmboat - Floating Markets & Maritime Heritage Events,1010 Valley Street,Seattle,,Washington,98109 +272,Vallco Farmers' Market,10101 N. Wolfe Rd.,Cupertino,Santa Clara,California,95014 +273,Abbotsford Farmers Market,1011 East Spruce St.,Abbotsford,Clark,Wisconsin,54405 +274,DeSoto Farmers' Market,10117 Hwy. 171,Grand Cane,De Soto,Louisiana,71032 +275,Glens Falls Farmers Market Association,1012 State Route 9,Queensbury,Warren,New York,12804 +276,Stone Gardens Farmers' Market,1012 Straits Rd.,New Hampton,Belknap,New Hampshire,3256 +277,Allamakee Farmers Market,1013 Rossville Road,Waukon,Allamakee,Iowa,52172 +278,Priest River Farmer's and Flea Market,1015 Aleni Hwy,Priest River,Bonner,Idaho,83856 +279,jackie moreno city Waco,1015 Hogan Lane appt. 6,Waco,McLennan,Texas,76705 +280,Sulphur Farmers Market,1015 South Ruth St.,Sulphur,Calcasieu,Louisiana,70664 +281,Findlay Farmers Market,1017 E Sandusky St,Findlay,,Ohio,45840 +282,OLD MILLSTREAM FARMERS' MARKET,1017 E. SANDUSKY ST.- Hancock County Fairgrounds,FINDLAY,Hancock County,Ohio, +283,Hardin County Farmers Garden Trade Day,1019 Clifton Rd.,Savannah,Hardin,Tennessee,38372 +284,Fountain Inn Farmers Market,102 Depot Street,Fountain Inn,Greenville,South Carolina,29644 +285,Wapakoneta Farmers' Market,102 East Auglaize St.,Wapakoneta,Auglaize,Ohio,45895 +286,Round Top Farmers Market Association,102 Main Street,Round Top,Fayette,Texas,78954 +287,Evansville Farmers Market,102 Maple St.,Evansville,Rock,Wisconsin,53536 +288,hauppauge farmers market,102 motor parway,Hauppauge,Suffolk,New York,11787 +289,Northport Farmers Market,102 N Rose Street,Northport,Leelanau,Michigan,49670 +290,Growers Market of Fuquay-Varina,102 N. Main St.,Fuquay-Varina,Wake,North Carolina,27526 +291,Vincennes Historic Farmers Market,102 N. Second St.,Vincennes,Knox,Indiana,47591 +292,Alva Farmers Market,102 North 2d,Alva,Woods,Oklahoma,73717 +293,Danbury Farmers Market,102 Old Church Road,Danbury,Stokes,North Carolina,27016 +294,Petersburg' Farmers Market,102 S. 7th St.,Petersburg,Menard,Illinois,62675 +295,"Downtown Sylvester Farmers Market, INC.",102 S. Main Street,Sylvester,Worth,Georgia,31791 +296,Fallbrook Certified Farmers Market,102 S. Main Street,Fallbrook,San Diego,California,92028 +297,Forest Farmer's Market,102 W. Lima St.,Forest,Hardin,Ohio,45843 +298,Huning Street Farmers and Artisan Market,1020 E. Huning,Show Low,Navajo,Arizona,85901 +299,The Farmers Market at Clear Lake Shores,1020 Marina Bay Drive,Clear Lake Shores,Galveston,Texas,77565 +300,Chino Valley Farmers Market,1020 N. State Road 89,Chino Valley,Yavapai,Arizona,86323 +301,Southwest Farmers Market,10200 Dixie Highway,Louisville,Jefferson,Kentucky,40272 +302,Farmers' Market at Poplar Grove,10200 US Hwy 17,Wilmington,Pender,North Carolina,28411 +303,Madison County Farmers Market,1022 Cook Avenue,Huntsville,Madison,Alabama,35804 +304,Ohio Valley Fruit & Vegetable Growers Asociation,1025 Lila Avenue,Milford,Clermont,Ohio,45150 +305,Clayton California Farmers' Market,1028 Diablo Street,Clayton,Contra Costa,California,94517 +306,Grant County Farmer's Market,1028 E Main St,Gas City,Grant,Indiana,46933 +307,"Webster's Joe Obbie Farmers' Market, Inc.","1028 Ridge Road, Webster Towne Center",Webster,Monroe,New York,14580 +308,Whistle Stop Park Farmers Market,103 4th St NE,Dilworth,Clay,Minnesota,56529 +309,The Montalvo House Community Market,103 E. Thomas Street,Brackettville,Kinney,Texas,78832 +310,The Pass Market,103 Fleitas Ave.,Pass Christian,Harrison,Mississippi,39571 +311,Blair Farmers Market,103 South 12th Street,Blair,Washington,Nebraska,68008 +312,Farmington Farmers Market,103 South Front St.,Farmington,Van Buren,Iowa,52626 +313,South Maple Street Farmers Market,103 South Maple Avenue,Davenport,Thayer,Nebraska,68335 +314,Bracken County Farmers Market II,103 West 2nd Street,Augusta,Bracken,Kentucky,41002 +315,Okanogan Valley Farmers Market,1030 2nd Ave. N,Okanogan,Okanogan,Washington,98840 +316,Organic Farmers Market at Hoovers,1035 Academy Drive,Altamonte Springs,Seminole,Florida,32714 +317,Scripps Ranch Farmers Market & Family Festival,10380 Spring Canyon Rd.,San Diego,San Diego,California,92131 +318,King George Farmers' Market,10381 Ridge Road,King George,King George,Virginia,22485 +319,D'Iberville Farmers Market,10383 Automall Parkway,D'Iberville,Harrison,Mississippi,39540 +320,San Marcos/New Braunfels Farmers Market Association,104 C.M. Allen Parkway,San Marcos,Hays,Texas,78666 +321,Coopers Cove Farmers Market,104 E. Avenue D,Lampasas,Lampasas,Texas,79045 +322,Main Street Elyria Farmers Market,104 Middle Ave.,Elyria,,Ohio,44035 +323,REC's Community Farmers Market - Fuller Family Park,104 Murray Ave.,Worcester,Worcester,Massachusetts,1610 +324,Chariton Farmers Market,104 N. Grand,Chariton,Lucas,Iowa,50049 +325,Haskell County Farmers Market,104 Northeast 6th St.,Stigler,Haskell,Oklahoma,74462 +326,Grand Rapids Farmers Market,104 NW 4th St,Grand Rapids,Itasca,Minnesota,55744 +327,Winter Garden Farmers' Market,104 S. Lakeview Ave,Winter Garden,Orange,Florida, +328,Oberlin Farmers Market,104 S. Penn St.,Oberlin,Decatur,Kansas,67749 +329,Eatonville Farmers Market,104 Washington Street,Eatonville,Pierce,Washington,98328 +330,True Value Patterson FM,1040 W. Las Palmas,Patterson,Stanislaus,California, +331,St. Charles Farmers' Market,10400 O’Donnell Place,St. Charles,Charles,Maryland,20603 +332,Desert Canyon Center Farmers Market,10405 McDowell Mountain Rd.,Scottsdale,Maricopa,Arizona,85250 +333,Chilton Farmers Market,1041 E. Chestnut St,Chilton,Calumet,Wisconsin,53014 +334,"Meade County Farmers Market, Inc",1041 Old Ekron Rd.,Brandenburg,Meade,Kentucky,40108 +335,Dover Cove Farmers' Market,1041 South St,Dover-Foxcroft,Piscataquis,Maine,4426 +336,Greene County Farmers Market,10415 Spotswood Trail,Stanardsville,Greene,Virginia,22973 +337,Jeffersontown Farmers Market,10416 Watterson Trail,Jeffersontown,Jefferson,Kentucky,40299 +338,Feed Mill's Farmer's Market,10494 Wisconsin Avenue,Hayward,Sawyer,Wisconsin,54843 +339,Northglenn Mall Farmers market,104th & I-25 Northglenn Mall,Northglenn,Adams,Colorado,80035 +340,Harvest Home Union Settlement Market,104th St and 3rd Ave,Manhattan,New York,New York, +341,East Harlem Farmer's Market,104th Street & 3rd Avenue,New York,New York,New York,10029 +342,Bay County Farmers Market,105 Adams St,Bay City,Bay,Michigan,48708 +343,Crystal City Farmers' Market,105 Bailley Rd.,Crystal City,Jefferson,Missouri,63019 +344,Jonesborough Farmers Market,105 Courthouse Square,Jonesborough,Washington,Tennessee,37659 +345,Downtown Daytona Beach Farmers Market,105 E. Magnolia Ave.,Daytona Beach,Volusia,Florida,32114 +346,Prairie Township Natural Products,105 Kern Road,Middletown,Montgomery,Missouri,63359 +347,Coteau Hills Farmers' Market,105 Main Ave South,Kulm,,North Dakota,58456 +348,King Farmers Market,105 Moore Road,King,Stokes,North Carolina,27021 +349,International City Farmers' Market,105 Mulberry St (Perkins Field),Warner Robins,Houston,Georgia,31093 +350,Columbus Downtown Farmer's Market,105 N. Dickason Blvd,Columbus,Columbia,Wisconsin,53925 +351,Jerseyville Farmers' & Artisan Market,105 N. Liberty Street,Jerseyville,Jersey,Illinois,62052 +352,NEW LEXINGTON FARMERS' MARKET,105 N. MAIN ST.,NEW LEXINGTON,Perry,Ohio, +353,Plainfield Chamber Farmers' Market,105 S. East Street,Plainfield,Hendricks,Indiana,46168 +354,Granville Corners Fruit & Vegetable Growers Association,105 Tupelo Circle,Oxford,Granville,North Carolina,27565 +355,Harvest with a Heart,105 W. Emeline Street,Milford,,Indiana,46542 +356,Historic Longview Farmers Market,105 West Cotton Street,Longview,Gregg,Texas,75605 +357,Del Mar Farmers Market,1050 Camino Del Mar,Del Mar,Tulare,California,92014 +358,Dansville Farmers' Market,1050 Dakin St.,Dansville,Ingham,Michigan,48819 +359,REC's Mobile Farmers Market - Webster Square Towers (WHA),1050 Main Street,Worcester,Worcester,Massachusetts,1610 +360,Crisp! Auburn Gresham,1050 W 79th St.,Chicago,Cook,Illinois,60620 +361,Stoughton Farmers Market,1050 W. Main Street,Stoughton,Dane,Wisconsin,53589 +362,Palm Beach Gardens GreenMarket,10500 North Military Trail,Palm Beach Gardens,Palm Beach,Florida,33410 +363,Fairfax Community Farmers' Market,10500 Page Avenue,Fairfax,Fairfax City,Virginia, +364,Fairfax Sunday Farmers Market,10500 Page Avenue,Fairfax,Fairfax City,Virginia,22030 +365,San Diego Mira Mesa Farmers Market,10510 Reagan Road,San Diego,San Diego,California,92126 +366,Akers of Strawberries,1054 Melton Rd.,Baker,Okaloosa,Florida,32531 +367,Full Circle Farm Stand,1055 Dunford Way,Sunnyvale,Santa Clara,California,94087 +368,Rosendale Farmers Market,1055 Rt.32,Rosendale,Ulster,New York,12472 +369,The Heritage Harvest Certified Farmers Market,10570 Foothill Boulevard CA,Rancho Cucamonga,San Bernardino,California,91730 +370,Twin City Farmers Market,106 Avenue A,Sterling IL,Whiteside,Illinois,61081 +371,Catonsville Farmers Market,106 Bloomsbury Ave,Catonsville,Baltimore,Maryland,20913 +372,The Cumming Harvest,"106 Colony Park Drive, Suite 100",Cumming,Forsyth,Georgia,30040 +373,Market Place On Broadway,106 East Broadway,Ardmore,Carter,Oklahoma,73401 +374,CONCORD MARKET,"106 East Jackson Rd (M-60),",Concord,Jackson,Michigan,49237 +375,Eden Street Market,106 Eden Street,Davidson,,North Carolina, +376,Tazewell Farmers Market,106 Gratton Rd,Tazewell,Tazewell,Virginia,24651 +377,coyote farm and home market,106 Maple,ashland,Boone,Missouri,65010 +378,Village Market Cooperative,106 N MARKET STREET (BEHIND THE PUBLIC LIBRARY),Rockville,Parke County,Indiana, +379,Darby Farmers Market,106 S Main Street,Darby,Ravalli,Montana,59829 +380,OLD GREGG SCHOOL FARMERS MARKET,106 School Street,Spring Mills,Centre County,Pennsylvania, +381,The Villa Rica Farmers Market @ The Mill,106 Temple Street,Villa Rica,Carroll,Georgia,30180 +382,Kingwood Farmers Market,106 W Main Street,Kingwood,Preston,West Virginia,26537 +383,Farm 2 Family Brunswick Friday Farmers Market,10600 Bubling Wells Rd,Grass Valley,Nevada,California,95945 +384,Mandarin Farmers Market by the Whole Foods Market,10601 San Jose Boulevard,Jacksonville,Duval,Florida,32259 +385,Chisago City Farmers Market,10656 Railroad Avenue,Chisago City,Chisago,Minnesota,55013 +386,Community Farmers Market at Brookland Baptist Church,1066 Sunset Blvd.,West Columbia,Richland,South Carolina,29169 +387,Main Street Statesboro Farmers Market,106c. Savannah Ave,Statesboro,Bulloch,Georgia,30458 +388,Deposit Farmers' Market,107 2nd Street,Deposit,Delaware,New York,13754 +389,Hopkinton Farmers Market,107 Beech Hill Road,Hopkinton,Merrimack,New Hampshire,3229 +390,HERITAGE PARK MARKET,107 COMER HALL,AUBURN UNIVERSITY,LEE,Alabama,36849 +391,Arenac Conservation District Farmers Market,107 N Main Street,Standish,Arenac,Michigan,48658 +392,Emporia Farmers Market,107 South Main Street,Emporia,Emporia,Virginia,23847 +393,Nacogdoches Farmers' Market,107 W. Pearl Street,Nacogdoches,Nacogdoches,Texas,75961 +394,Downtown Hays Market,107 West 10th St.,Hays,,Kansas,67601 +395,Steeleville Farmers Market,107 West Broadway,Steeleville,Randolph,Illinois,62288 +396,Gulfport Harbor Market,1070 23rd Ave.,Gulfport,Harrison,Mississippi,39501 +397,Green Market at Piedmont Park,1071 Piedmont Ave NE,Atlanta,Fulton,Georgia,30309 +398,Mid Del Farmers' Market,10713 East Reno,Midwest City,Oklahoma,Oklahoma,73130 +399,Golden Mile Farmers Market,10744 Back Mountain Road,Milroy,Mifflin,Pennsylvania,17063 +400,Green Spring Station Farmers Market,10751 Falls Road,Baltimore,Baltimore,Maryland,21212 +401,Jay Village Farmers' Market,1077 Vermont Route 242,Jay,,Vermont,5859 +402,Grand Court Farmers' Market,107th Street and Wornall Road,Kansas City,Jackson,Missouri,64137 +403,Ashe County Farmers Market,108 Backstreet,West Jefferson,Ashe,North Carolina,28694 +404,Smyrna Farmers Market,108 David Collins Drive,Smyrna,Rutherford County,Tennessee, +405,Hip Donelson Community Farmers Market,108 Donelson Pike,Nashville,,Tennessee,37214 +406,Edmonson County Farmers’ Market,108 Ferguson Street,Brownsville,Edmonson,Kentucky, +407,Boaz Farmers Market,108 Line Street,Boaz,Marshall,Alabama,35957 +408,Carver Farmers' Market,108 Main St.,Carver,Plymouth,Massachusetts,2330 +409,Rec Park Farmers Market,108 Montgomery Ave.,Lewistown,Mifflin,Pennsylvania,17044 +410,Idabel Farmers Market,108 North Central Main Street,Idabel,McCurtain,Oklahoma,74745 +411,Wichita County Farmers' Market,108 S. 4th Street,Leoti,Wichita,Kansas,67861 +412,Chilhowee Main Street Farmers' Market,108 S. Main St.,Chilhowee,Johnson,Missouri,64733 +413,Blacksburg Farmers Market,"108 W Roanoke St, Suite 101",Blacksburg,Montgomery,Virginia,24060 +414,Rockmart Farmers' Market,108 Water St.,Rockmart,,Georgia,30153 +415,Selma/Dallas County Farmers Market,108 West Dallas Avenue,Selma,Dallas,Alabama,36701 +416,Clawson Farmers Market,1080 N Custer,Clawson,Oakland,Michigan,48017 +417,The Boise Farmers Market,1080 W. Front Street,Boise,Ada,Idaho,83701 +418,Sassy Pea Market/Good Earth Petting Farm (at The Good Earth Day School),10820 East Crystal Falls Parkway,Leander,,Texas,78641 +419,"Conover Farmers Market, Inc",109 1st Street East,Conover,Catawba,North Carolina,28613 +420,Ralph H. Johnson Medical Center Farmers Market,109 Bee St.,Charleston,Charleston,South Carolina,29401 +421,Enid Farmers Market,109 E. Garriott Road,Enid,Garfield,Oklahoma,73703 +422,Homer Farmers Market,109 East Leigh street (M-60),Homer,Calhoun,Michigan,49245 +423,Broadway Farmers Market,109 North Main Street,Broadway,,Virginia,22815 +424,Coventry Farmers Market,109 North Road,,Chenango,New York, +425,New Britain Farmers Market,109 North Street,New Britain,Hartford,Connecticut,6051 +426,Local Farmers Market at the Shoppes at the Flight Deck in Lexington,109 Old Chapin Rd.,Lexington,Lexington,South Carolina,29072 +427,Clifton Farmers Market,109 S Scribner St,Clifton,Washington,Kansas,66937 +428,Downtown Farmerington Farmers Market,109 Spruce Street,Framington,Dakota,Minnesota,55024 +429,Cortez Farmers Market,109 W Main Street,Cortez,Montezuma,Colorado,81321 +430,Farmers Market at Latham UMC,109 Weatherly Road,Huntsville,,Alabama,35803 +431,Freedom Farmers Market,10905 Livingston Road,Fort Washington,Prince George's,Maryland,20744 +432,Bloomingrove Produce Auction,1091 Free Rd,Shiloh,Richland,Ohio,44878 +433,Whitehouse Farmers' Market,10911 Toledo Street,Whitehouse,Lucas,Ohio,43571 +434,The Cornerstone Market,1095 Allen Road,Greenville,Pitt,North Carolina,27834 +435,Walt L. Shamel Community Farmers Market(on Dean Street),1095 Dean Street,Brooklyn,New York,New York,11216 +436,New Gloucester Community Market,1095 Lewiston Rd. (Rt. 100),New Gloucester,Cumberland,Maine,4260 +437,The Boise Farmers Market,10th & Grove St.,Boise,Ada,Idaho,83701 +438,Cheyenne County Farmers Market,10th & Jackson Street,Sidney,Cheyenne,Nebraska,69162 +439,Downtown Topeka Farmers Market,10th & Topeka Blvd.,Topeka,Shawnee,Kansas,66618 +440,Cool Spring Farmers Market,10th and Jackson Street,Wilmington,New Castle,Delaware,19805 +441,Brookland Farmers Market,"10th and Otis Streets, NE",District of Columbia,District of Columbia,District of Columbia, +442,Capitol Midweek Farmers' Market,10th Ave. & Jackson Street,Topeka,Shawnee,Kansas,66612 +443,Golden Farmers Market,10th Avenue & Illinois Street,Golden,Jefferson,Colorado,80401 +444,Myrtle's Market (Myrtle Beach Farmers Market),10th Avenue & Oak Street,Myrtle Beach,Horry,South Carolina,29578 +445,Rendezvous Region Langdon Farmers Market,10th Avenue and 3rd Street,Langdon,Cavalier,North Dakota,58249 +446,Sacramento Chavez Plaza Certified Farmers' Market,10th St and J St,Sacramento,Sacramento,California,95814 +447,Collinsville Farmers Market,10th St. & Center,Collinsville,Tulsa,Oklahoma,74021 +448,Downtown Tracy Certified Farmers Market,10th Street,Tracy,San Joaquin,California,95376 +449,Fortuna Farmers Market,10th Street & L,Scotia,Humboldt,California,95518 +450,Sunblest,10Th Street Modesto,Modesto,Stanislaus,California, +451,REC's Mobile Farmers Market - Lincoln Towers (WHA),11 Lake Ave.,Worcester,Worcester,Massachusetts,1610 +452,North Amherst Winter Farmers' Market,11 Meadow St.,Leverett,Hampshire,Massachusetts,1054 +453,Martin's Farmstand,11 Needham Rd.,Potsdam,St. Lawrence,New York, +454,Stonington Farmers Market,"11 Northwest Street, Town Dock",Stonington,New London,Connecticut,6378 +455,Penacook Village Farmers' Market,11 Penacook St.,Penacook,Merrimack,New Hampshire,3303 +456,Morgan County Farmers' Market,11 W Carlisle Street,Mooresville,Morgan,Indiana,46158 +457,"Blue Moon Acres Farm Market- Pennington, NJ",11 Willow Creek Dr.,Pennington,,New Jersey,8534 +458,Local Farmers Market,110 1st Street E.,Park Rapids,Hubbard,Minnesota,56470 +459,West Frederick Farmers' Market,110 Baughman's Lane,Frederick,Frederick,Maryland,21701 +460,Cape Charles Farmers Market,110 Blue Heaven Rd.,Cape Charles,,Virginia,23310 +461,Cape Charles Farmers Market,110 Blue Heaven Rd.,Cape Charles,,Virginia,23310 +462,Johnson County Farmers Market,110 Court St.,Mountain City,Johnson,Tennessee,37683 +463,Talent Evening Market,110 E Main St,Talent,Jackson,Oregon,97540 +464,North Umpqua Farmers and Artisans Regional Marketplace (NUFARM),110 East B. Avenue,Drain,Douglas County,Oregon, +465,Lenny's Farmers market,110 North Hampton Street,Americus,Sumter,Georgia,31709 +466,Giles County Farmers Market,110 North Second Street,Pulaski,Giles,Tennessee,38478 +467,Gravette Farmers' Market,110 Park Drive,Gravette,Benton,Arkansas,72736 +468,Rogue River SUnday Market,110 Pine Street,Rogue RIver,Jackson,Oregon,97537 +469,historic lewes farmers market,110 Shipcarpenter Street,Lewes,,Delaware,19958 +470,historic lewes farmers market,110 Shipcarpenter Street,Lewes,Sussex,Delaware,19958 +471,Santa Barbara La Cumbre Farmers Market,110 South Hope Avenue,Santa Barbara,Santa Barbara,California,93101 +472,Howard County Farmers Market,110 South Washington Street,Nashville,Howard,Arkansas,71852 +473,Corvallis Indoor Winter Market,110 SW 53rd St,Corvallis,Benton,Oregon,97333 +474,Warren Farmers Market,110 W Main St.,Warren,,Illinois,61087 +475,Hopkinsville-Christian County Downtown Farmers Market,110 West 9th Street,Hopkinsville,Christian,Kentucky,42240 +476,Keller Farmers Market,1100 Bear Creek Parkway,Keller,Tarrant,Texas,76244 +477,Hollywood Media Farmers Market,1100 Block of Cole Ave.,Hollister,Los Angeles,California,95023 +478,Radford Farmers Market,1100 block of East Main Street,Radford,Bedford,Virginia,24141 +479,Zerns Farmers Market and Auction,1100 E. Philadelphia Ave,Gilbertsville,Montgomery,Pennsylvania,19525 +480,Prescott Farmers Market,1100 E. Sheldon Street,Prescott,Yavapai,Arizona,86301 +481,Great Mall CFM,1100 Great Mall Drive,Milipitas,Santa Clara,California,95035 +482,New Richmond Farmers Market,1100 Heritage Drive,New Richmond,St. Croix,Wisconsin,54017 +483,South Milwaukee Downtown Market,1100 Milwaukee Avenue,South Milwaukee,Milwaukee,Wisconsin,53172 +484,Bellingham Farmers Market,1100 Railroad Avenue,Bellinhgam,Whatcom,Washington,98225 +485,Trinity Episcopal Church Farmers Market,1100 Sumter Street,Columbia,Richland,South Carolina,29201 +486,Tuacahn Saturday Market,1100 Tuacahn Drive,Ivins,Washington,Utah,84738 +487,Huntsville Downtown Farmers Market,1100 University Avenue,Huntsville,Walker,Texas,77340 +488,Tucson Farmers' Market at Oro Valley,11000 N. La Canada Blvd.,Oro Valley,Pima,Arizona,85737 +489,Pinecrest Gardens Farmers Market,11000 SW 57th Avenue,Pinecrest,Miami-Dade,Florida,33156 +490,Dubuque Winter Farmers Market,1101 Central Ave,Dubuque,Dubuque,Iowa,52001 +491,Mosinee Farmers Market,1101 Main Street,City,Marathon,Wisconsin,54455 +492,Gardens Summer GreenMarket at STORE,11010 North Military Trail,Palm Beach Gardens,Palm Beach,Florida,33410 +493,Woodstock Farmers Market,1102 McConnell Road,woodstock,McHenry,Illinois,60098 +494,Northside Farmers' Market - Youngstown,1105 Elm Street,Youngstown,Mahoning,Ohio,44505 +495,South Bend Farmers Market,1105 Northside Blvd.,South Bend,St. Joseph,Indiana,46615 +496,City of Perry Farmers Market,1106 Meeting Street,Perry,Houston,Georgia,31069 +497,Nevada County Farmers Market,11078 West First Street North,Prescott,Nevada,Arkansas,71857 +498,Morningside Park Farmers Market,110th Street & Manhattan Avenue,Mornignside Heights,New York,New York,10027 +499,Fletcher Allen's Farmers' Market,111 Colchester Ave 204 EN3,Burlington,Chittenden,Vermont,5401 +500,Montefiore Medical Center Farmers Market_Thursday,111 E. 210th Street,Bronx,Bronx,New York,10467