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

Scissors - Ivana #67

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

Scissors - Ivana #67

wants to merge 2 commits into from

Conversation

i-vs
Copy link

@i-vs i-vs commented Apr 7, 2021

No description provided.

i-vs added 2 commits April 5, 2021 22:05
- Add missing Docstrings in Item Child Classes
- Add new methods to get and swap items by age
- Add new test wave 7 to test new methods
Copy link

@jmaddox19 jmaddox19 left a comment

Choose a reason for hiding this comment

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

Great work! So amazing that you were able to build the optional functionality AND WRITE TESTS for it!

"""

def __init__(self, condition=0, age=0):
super()

Choose a reason for hiding this comment

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

This isn't actually doing anything as its written here.

Copy link
Author

Choose a reason for hiding this comment

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

I think I get super() now! finallyyyy

Comment on lines +12 to +14
self.category = "Clothing"
self.condition = condition
self.age = age

Choose a reason for hiding this comment

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

This totally works but there is a tiny opportunity to DRY up your code a little but calling super().__init__() with these parameters from the child classes instead. It would be worth trying to rewrite these to utilize that if you can

Copy link
Author

Choose a reason for hiding this comment

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

will do that!

Comment on lines +32 to +43
descriptions = {
5: "Like New",
4: "Mint",
3: "Very Good",
2: "Good",
1: "Fair",
0: "Poor"
}

if self.condition not in descriptions:
return None
return descriptions[self.condition]

Choose a reason for hiding this comment

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

Clever!

Comment on lines +103 to +109
if not self.inventory or not friend.inventory:
return False
else:
my_item = self.inventory.pop(0)
self.add(friend.inventory.pop(0))
friend.add(my_item)
return True

Choose a reason for hiding this comment

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

This looks a lot like the code in the method above. It may be worth seeing if you can revisit this to DRY up your code by calling the other method from this one

Copy link
Author

Choose a reason for hiding this comment

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

So it took me a while to understand how I could be able to use the swap here, in the beginning it seemed that it wouldn't do exactly what I wanted until I figured out (with the help of my tutor) that I should just index the first item in each vendors' lists on method call :)) will change this!

best_cond = 0
best_item = None

for item in self.get_by_category(item_category):

Choose a reason for hiding this comment

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

Great use of an existing method!

Copy link
Author

Choose a reason for hiding this comment

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

thank you!

Comment on lines +150 to +155
mine = self.get_best_by_category(their_priority)
theirs = other.get_best_by_category(my_priority)
if not mine or not theirs:
return False
else:
return self.swap_items(other, mine, theirs)

Choose a reason for hiding this comment

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

Great!

else:
return self.swap_items(other, mine, theirs)

def get_by_newest(self):

Choose a reason for hiding this comment

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

Love that you were able to do this optional and that you created this helper method rather than trying to do all the work in swap_by_newest!

Copy link
Author

Choose a reason for hiding this comment

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

glad I managed to DRY this part properly!

@@ -0,0 +1,77 @@
import pytest

Choose a reason for hiding this comment

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

OMG And you wrote tests?!?!~~

Choose a reason for hiding this comment

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

These tests look great!

Copy link
Author

Choose a reason for hiding this comment

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

thank you SO much for this feedback, Jared! I'm sorry for taking so long to answer, I'll implement the changes as you suggested. Thanks again and have a great weekend!

Choose a reason for hiding this comment

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

Ivana, I love that you took the time to respond to this feedback! You are definitely welcome to update your code with the suggestions I offered but I want to make sure you know you aren't expected or required to.
The feedback is first and foremost feedback for you to incorporate in future code submissions. :)

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