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

Lindsay and Hannahs Viewing Party #37

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

Conversation

lindsaybolz
Copy link

No description provided.

Copy link
Contributor

@audreyandoy audreyandoy 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 Lindsay and Hannah! You hit all the learning goals for this project and all tests are passing. You have earned a well-deserved 🟢 grade on this project ✨

I added comments, compliments, and hints on ways to refactor your code.

Keep up the great work! ✨

Comment on lines +154 to +159
expected = {
"watchlist" : [],
"watched" : [{"title": MOVIE_TITLE_1,
"genre": GENRE_1,
"rating": RATING_1}]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

# *******************************************************************************************
# ****** Add assertions here to test that the correct movie was added to "watched" **********
# *******************************************************************************************
assert updated_data == expected
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +181 to +186
expected = {
"watchlist" : [
FANTASY_1,
],
"watched" : [FANTASY_2, movie_to_watch]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +59 to +60
assert INTRIGUE_3 in friends_unique_movies
assert amandas_data == expected
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +55 to +59
# Act
recommendations = get_new_rec_by_genre(sonyas_data)

# Assert
assert len(recommendations) == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +122 to +127
for friend in user_data["friends"]:
for movie in friend["watched"]:
if movie["title"] in friends_unique_watched_titles:
if movie["title"] not in added_titles:
friends_unique_watched_movies.append(movie)
added_titles.append(movie["title"])
Copy link
Contributor

Choose a reason for hiding this comment

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

A helper function that creates single list of all the friend's movies would be helpful in condensing this function a bit.

Comment on lines +137 to +148
def get_available_recs(user_data):
# create subscriotions, user_watched, and friends_watched lists
subscriptions = set(user_data["subscriptions"])
user_watched_titles = get_user_watched_titles(user_data)
friends_watched = get_friends_unique_watched(user_data)

# find the movies that are not in user watched and that are available with subscriptions
recommended = []
for movie in friends_watched:
if movie['title'] not in user_watched_titles and movie['host'] in subscriptions:
recommended.append(movie)
return recommended
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +157 to +167
def get_new_rec_by_genre(user_data):
# get most freq genere and friends watched.
most_frequent_genre = get_most_watched_genre(user_data)
friends_watched = get_friends_unique_watched(user_data)

# find recommendations if user hasnt watched and genre is most freq
recommendations = []
for movie in friends_watched:
if movie not in user_data['watched'] and movie['genre'] == most_frequent_genre:
recommendations.append(movie)
return recommendations
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

def get_rec_from_favorites(user_data):
# create favorites and user_watched_titles
favorites = user_data["favorites"]
user_watched_titles = [movie['title'] for movie in get_unique_watched(user_data)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome work using list comprehension 🔥

Comment on lines +175 to +181
# get recommendations if the movie is in faves and unique user movies
recommendations = []
for movie in favorites:
if movie['title'] in user_watched_titles:
recommendations.append(movie)

return recommendations
Copy link
Contributor

Choose a reason for hiding this comment

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

We could return the list literal from the list comprehension like so:

return [ movie for movie in favorites if movie['title'] in user_watched_titles]

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