Skip to content
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 - Angele #34

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Branches - Angele #34

wants to merge 17 commits into from

Conversation

geli-gel
Copy link

Grocery Store

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Response
What is accomplished with raise ArgumentError? If the program is about to try to execute something that the computer can't do because the argument provided to a method will cause an error, it lets the user know what happened and the stack trace will tell the user what line and method that error happened at so that the user has a clue how to fix the problem.
Why do you think we made the .all & .find methods class methods? Why not instance methods? They are class methods because you shouldn't need to create an instance of a class in order to look up info about the class.
Think about the relation between Order and Customer. Is this relation one-to-one, one-to-many, or something else? How does that compare to the Solar System project? I think the relation is best described as one customer to many orders, similar to how one solar system had many planets.
How is the relation between Order and Customer tracked in the CSV file? How is it tracked in your program? Why might these be different? The relation between order and customer is tracked in the CSV file by ID numbers (order ID and customer ID in the orders.csv file, and no information about orders in the customer file. In the program the information for the customer is within each order, but the program has to look up the customer by their ID. If you are instead starting with a customer and looking up their orders, you have to search though the orders to return the ones where their ID matches the customer's ID. These are different from CSV to the program because the program needs to know all the information about the customer in each order but has to look it up in the other CSV in order to create an instance of the customer class, so that it's easier to look up the information.
Did the presence of automated tests change the way you thought about the problem? How? Yes, I started trying to think from the test first perspective, which was hard since it's not what I'm used to, but it helped to sort of more concretely get the ideas of what each method does stuck in my head, more than just a single sentence saying what it does overall, it makes you think of all the types of normal things it should do, which helps make it clearer what the pseudocode and finally code should look like.

@@ -7,7 +7,7 @@

Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new

describe "Order Wave 1" do
xdescribe "Order Wave 1" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't ignore tests once they pass, since part of their value is in catching if you introduce a new bug.


def self.find(id)
customer_data = self.all
return customer_data.find { |customer| customer.id == id }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great use of find! 🎉

@fulfillment_status = fulfillment_status

valid_statuses = [:pending, :paid, :processing, :shipped, :complete]
if !valid_statuses.include? @fulfillment_status

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For checks like this you can use unless CONDITION instead of if !CONDITION which reads a little clearer since it's easy to overlook the !

Suggested change
if !valid_statuses.include? @fulfillment_status
unless valid_statuses.include? @fulfillment_status

@kaidamasaki
Copy link

Well done! Your code was clear and concise.

One thing that I wanted to make sure to point out again is that some of your tests were ignored when you checked in your code. This wasn't a big deal here because all of them still passed but it's important to run all of your tests before you check code in so that you can be sure you didn't break something.

Overall though this was a really strong submission. Again, well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants