Skip to content

Sapphire - Kathleen Shin#47

Open
kathleenshin wants to merge 19 commits into
Ada-C19:mainfrom
kathleenshin:main
Open

Sapphire - Kathleen Shin#47
kathleenshin wants to merge 19 commits into
Ada-C19:mainfrom
kathleenshin:main

Conversation

@kathleenshin

Copy link
Copy Markdown

No description provided.

@tildeee tildeee left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tagging @erickalucia for visibility

Great work, Kathleen and Ericka! This project looks great and it's marked as a "green."

Overall, the code is well-written, and had the approach and solutions I was hoping for. I wish I had more feedback, but truly, the code was readable and good. Keep doing what you're doing!

Some of my comments are about small logic things, so let me know what questions come up from it.

In addition, your git hygiene is great. I'd recommend saying "Implemented" instead of "completed" because no code is ever truly complete >:P It seems like Ericka's account didn't get to push anything to this project, reach out to me if there's a Git issue that needs to be sorted out.

Also, your tests look great, and your team reflections look great!

Again, overall you two did a great job. Let me know if any questions come up.

Comment thread viewing_party/party.py
Comment on lines +7 to +13
if not title:
return None
elif not genre:
return None
elif not rating:
return None
else:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good if/elif/else conditionals! The line return None is repeated a few times. It might be nice to refactor and combine some of these conditional cases. DRY!

Comment thread viewing_party/party.py
genre_length = len(movie_genre_dict[genre])
if genre_length >= max_count:
max_genre = genre
max_count = len(movie_genre_dict.values())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hmm... Looking through your logic, I see that if a genre's length is bigger than max_count, then this genre is the new max_genre and its length is the new max_count. I would expect this line to be:

            max_count = len(movie_genre_dict[genre])

This code also passes the tests!

Comment thread viewing_party/party.py
Comment on lines +165 to +166
if len(friends_watched) == 0:
return rec_by_genre

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actually, we can get rid of this conditional and the tests still pass! If friends_watched is empty, then the code skips the below for loop, but still returns rec_by_genre (which is still an [])

Comment thread viewing_party/party.py
Comment on lines +79 to +80
if len(user_data["watched"]) == 0:
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I've written a similar comment in get_new_rec_by_genre. Turns out, we can delete these two lines, and the tests still pass. If users_data["watched"] is empty, then it skips the for loop below, still sets max_genre to None. Then, because movie_genre_dict will be empty, it'll skip that for loop too... leading to return max_genre!

I'm emphasizing this point because it's helpful to trust that a for loop will not break if it iterates over an empty [] or {}. If we trust that, then we can save ourselves on writing extraneous code, and extraneous code always has potential to lead to more bugs.

Comment thread viewing_party/party.py
else:
user_data["watched"].append(movie)
user_data["watchlist"].remove(movie)
print (user_data)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] Flagging a stray print statement that got left behind. Also, lines 20 and 29-32. Keep printing things and testing them! It'd be nice if they were deleted by submission time, or even before they're committed to git.

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