Branches - Amal - #26
Conversation
|
Good job! You had some style issues with your code but otherwise everything was very solid and clear. |
| end | ||
|
|
||
|
|
||
| def self.find (id) |
There was a problem hiding this comment.
You shouldn't have spaces between a method name and its argument list.
| def self.find (id) | |
| def self.find(id) |
That's where this warning is coming from:
/Users/kaida/Developer/cohort-12/grocery-store/lib/customer.rb:25: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument
|
|
||
| fulfillment_statuses = [:pending, :paid, :processing, :shipped, :complete ] | ||
| if !fulfillment_statuses.include?(@fulfillment_status) | ||
| raise ArgumentError |
There was a problem hiding this comment.
It would be helpful to include a message here so the user knows what went wrong.
| raise ArgumentError | |
| raise ArgumentError.new("Invalid fulfillment status: #{@fulfillment_status}") |
| data = CSV.read('data/orders.csv') | ||
| new_data = data.map do |person| | ||
| products = {} | ||
| person[1].split(';').each do |hash| |
There was a problem hiding this comment.
It's confusing to name a string hash, it would be clearer to do something like product or raw_product.
|
|
||
| def self.find (id) | ||
| data = self.all | ||
| person_found = data.select {|person| person.id == id } |
There was a problem hiding this comment.
You may want to look at Enumerable#find.
| # TODO: Your test code here! | ||
| end | ||
|
|
||
| it "Returns accurate information about the first order" do |
There was a problem hiding this comment.
Your indentation is kind of weird here and is why Github thought you deleted this test. (It looks like you moved some tests outside of describes.)
Some sort of formatter for VS Code could help you with noticing changes like this.
Grocery Store
Congratulations! You're submitting your assignment.
Comprehension Questions
raise ArgumentError?.all&.findmethods class methods? Why not instance methods?OrderandCustomer. Is this relation one-to-one, one-to-many, or something else? How does that compare to the Solar System project?OrderandCustomertracked in the CSV file? How is it tracked in your program? Why might these be different?