Skip to content

Ruby-Sarah Kim #63

Open
suyon02kim wants to merge 10 commits into
Ada-C19:mainfrom
suyon02kim:main
Open

Ruby-Sarah Kim #63
suyon02kim wants to merge 10 commits into
Ada-C19:mainfrom
suyon02kim:main

Conversation

@suyon02kim

Copy link
Copy Markdown

No description provided.

@mmcknett-ada mmcknett-ada 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.

Great job! Green 🟢

Overall comments:

  • Great job implementing the new test cases
  • Think about whether you could reduce the time complexity of some of the deeply-nested loops you have.
  • Your code is well-formatted and easy to read!

Comment thread README.md
Comment on lines +351 to +357
def get_available_recs(user_data):
recommended_movies = []
user_not_watched = get_friends_unique_watched(user_data)
for movie_dict in user_not_watched:
if movie_dict["host] in user_data["subscriptions]:
recommended_movies.append(movie_dict)
return recommended_movies

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks like you got some code in your markdown. 😄

Comment thread tests/test_wave_01.py
assert movie in updated_data["watchlist"]
assert FANTASY_2 in updated_data["watchlist"]

@pytest.mark.skip()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[opinion] I appreciate that you removed these instead of just commenting them out.

Comment thread tests/test_wave_02.py
assert average == pytest.approx(0.0)

@pytest.mark.skip()
def test_calculates_watched_average_rating():

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice, I love seeing tests added when the existing tests don't cover the behavior. 😄

Comment thread tests/test_wave_03.py

# Assert
assert len(friends_unique_movies) == 3
assert friends_unique_movies == [FANTASY_4, HORROR_1, INTRIGUE_3]

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] I'd probably assert each individually, similar to test_friends_unique_movies. Asserting equality with the list forces a specific order as well.

Comment thread viewing_party/party.py
Comment on lines +6 to +9
movie["title"] = title
movie["genre"] = genre
movie["rating"] = rating
return movie

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rather than creating an empty dictionary, then assigning the keys, we can use dictionary literal syntax to create the dictionary all at once.

    movie_dict = { 'title': title, 'genre': genre, 'rating': rating }
    return movie_dict

It could even be done all on one line

    return { 'title': title, 'genre': genre, 'rating': rating }

Comment thread viewing_party/party.py
# ------------- WAVE 3 --------------------
# -----------------------------------------
def get_most_watched_genre(user_data):
favorite_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.

[naming] I'd pick something like genre_counts for this. It holds multiple genres, not just a single favorite genre.

Comment thread viewing_party/party.py
Comment on lines +59 to +62
for user_movies in user_data["watched"]:
user_watched_movie.append(user_movies)
# Check to see if the user movie title is within the whole set of friend's watched list
for movie_info in user_watched_movie:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since user_watched_movie is just a copy of user_data["watched"] and you never modify the watched list, you can just iterate over it directly:

for movie_info in user_data["watched"]:

Comment thread viewing_party/party.py
def get_friends_unique_watched(user_data):
movie_friend_watched = []
only_friends_watched = []
for watched_list in user_data["friends"]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[naming] I prefer calling this dictionary a friend instead of a watched_list since then you get the watched list by accessing friend["watched"].

for friend in user_data["friends"]:
    for movie in friend["watched"]:

Comment thread viewing_party/party.py
Comment on lines +75 to +76
for movie_info in movie_friend_watched:
if movie_info not in user_data["watched"]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What's the big-O time complexity of this loop? (Consider what in has to do in the if statement.)

Comment thread viewing_party/party.py
#generated a list of all the movies friends watched
for watched_list in user_data["friends"]:
for movie in watched_list["watched"]:
if movie not in friend_watched:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[perf] Another big-O question here -- what does this if statement do to the big-O time complexity of the overall loop?

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