-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Branches - Amal #26
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 describe
s.)
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
&.find
methods class methods? Why not instance methods?Order
andCustomer
. Is this relation one-to-one, one-to-many, or something else? How does that compare to the Solar System project?Order
andCustomer
tracked in the CSV file? How is it tracked in your program? Why might these be different?