Dikla Rikovich Grocery Store Octos#43
Conversation
Grocery StoreWhat We're Looking For
This is a good start. Your code for waves 1 and 2 is well-organized, accurate and easy to read, and I'm happy with your test cases for wave 2 as well. I am concerned that you did not make it to wave 3. Not getting to practice inheritance will make next week's project more difficult, and it also indicates that you're writing code slower than we would like. Being able to quickly and confidently solve problems is something that will grow with time and practice. One way to drill it is to take a small practice problem and build it starting from an empty file. The loop practice problems or something like flower or library is a good option. This is also something you can target with a tutor. This stuff isn't easy. I've seen you putting in the hours, and I really appreciate how hard you've been working. Keep up that dedication and keep your spirits high, and I know you'll get there. |
| products_hash[product_name] = product_price | ||
| end | ||
| order = Order.new(id, products_hash) | ||
| orders << order |
There was a problem hiding this comment.
Good work getting this complex bit of logic worked out!
| order_id = nil | ||
| self.all.each do |order| | ||
| if order.id == id | ||
| order_id = order |
There was a problem hiding this comment.
I'm not sure the name order_id describes what you're using this variable for. It looks like it's storing an order, not an ID. Something like matching_order might be a better choice.
|
|
||
|
|
||
| ap Grocery::Order.all | ||
| # puts " Product #{product[0]}: #{product[1]}" |
There was a problem hiding this comment.
Please remove debugging print statements like this before submitting projects.
Grocery Store
Congratulations! You're submitting your assignment.
Comprehension Questions
raise ArgumentError?.all&.findmethods class methods? Why not instance methods?Orderto get the list of all orders, which doesn't make much sense. With class methods, all you need is to know that there is such a thing as anOrder, and then you can callOrder.allto get the list.