./lib/customer_request.rb in burger_game-0.1.1 vs ./lib/customer_request.rb in burger_game-1.0.0
- old
+ new
@@ -32,15 +32,17 @@
# Parse JSON file into array
@@all_customers = JSON.parse(customer_file)
@@customer_responses = JSON.parse(response_file)
# Collect customer names (array of strings)
+ # and number of customers
# and customer recipe names request (array of strings)
# and customer ingredient changes (array of hashes)
# and customer requests text (array of strings)
# and customer preferences text (array of strings)
@@customer_names = []
+ @@no_of_customer = 0
@@customer_recipe_names = []
@@customer_ingredient_changes = []
@@customer_requests_text = []
@@customer_preferences_text = []
@@all_customers.each do |customer|
@@ -50,17 +52,22 @@
@@customer_ingredient_changes << request[0].values[0][0]
@@customer_requests_text << request[1].values.join
@@customer_preferences_text << request[2].values.join
end
end
+ @@no_of_customer = @@customer_names.length
# Collect customer responses (array of arrays of hashes)
@@responses = []
@@customer_responses.each do |responses|
@@responses << responses.values
end
def initialize
+ end
+
+ def self.no_of_customer
+ @@no_of_customer
end
def get_request(customer_no)
# Get all original recipes for base recipes (array of hashes)
base_recipes = Recipe.all_recipes
\ No newline at end of file