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

Zoisite - Sabs F & Yael P #58

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

Zoisite - Sabs F & Yael P #58

wants to merge 17 commits into from

Conversation

sabsford
Copy link

No description provided.

Copy link

@apradoada apradoada left a comment

Choose a reason for hiding this comment

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

Overall, this works and will receive a green. I left some comments to think about, specifically around duplicate asserts and really using helper functions to your advantage!

raise Exception("Test needs to be completed.")
assert MOVIE_TITLE_1 == updated_data["watched"][0]["title"]
#my assert
assert MOVIE_TITLE_1 == updated_data["watched"][0]["title"]

Choose a reason for hiding this comment

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

You have two of the same assert statements here. Just be careful with that! Also, when we write equality asserts, it is typically best practice for the constants to be on the right had side of the assignment.

# assert FANTASY_4 in friends_unique_movies
assert friends_unique_movies.count(INTRIGUE_3) == 1
assert friends_unique_movies.count(HORROR_1) == 1
assert friends_unique_movies.count(FANTASY_4) == 1

Choose a reason for hiding this comment

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

Nice use of the count method in these asserts!

# ****** Complete the Act and Assert Portions of these tests **********
# *********************************************************************
#the assert i wrote, lets hope this works
assert actual_output == []

Choose a reason for hiding this comment

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

This assert works!

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

Choose a reason for hiding this comment

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

This looks great! The one small suggestion I'll make is that if a function doesn't explicitly return anything, it will return None by default. As a result, this else is actually unnecessary!


def add_to_watchlist(user_data, movie):
user_data["watchlist"].append(movie)
return user_data

Choose a reason for hiding this comment

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

These two look great!

for friend in friend_list:
user_watched_list = user_data["watched"]
for movie in friend["watched"]:
subscription_list = user_data["subscriptions"]

Choose a reason for hiding this comment

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

Because this list is inside the loop, it's technically getting remade every single time. Best practice would have this list up with your other local variables!

subscription_list = user_data["subscriptions"]
if movie["host"] in subscription_list and movie not in user_watched_list and movie not in recommendations:
recommendations.append(movie)
return recommendations

Choose a reason for hiding this comment

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

This function would be a great place to start leveraging your helper functions that you have created! For example, we have a way to isolate the movies that the user has not seen but at least one friend has (get_friends_unique_watched). Looping through that list will allow you to both cut down on the nested loops and cut down on the compound conditionals you've written!

#will return popular genre

for movie in user_friend_watched:
if movie not in user_watched:

Choose a reason for hiding this comment

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

Remember that user_friend_watched specifically checks to make sure a movie hasn't been seen by the user! That renders this conditional unnecessary!

if movie not in user_watched:
if movie["genre"] == user_most_watched_genre:
genre_recommended_movies.append(movie)
return (genre_recommended_movies)

Choose a reason for hiding this comment

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

The rest of this looks great!


return fav_recommended_movies

Choose a reason for hiding this comment

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

This will work, but remember we have helper functions we've created that will do a lot of this for us. Make sure you are using those to more appropriately approach this problem!

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.

3 participants