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

Complete! #66

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

Complete! #66

wants to merge 23 commits into from

Conversation

valerie-valentine
Copy link

Ready for thy feedback!

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.

GREEN! Overall this looks great with the caveat that for each loops are better than for i in range in this case! It cuts down on any confusion that might stem from having to loop through the indices as opposed to looping through the dictionaries directly!

if title and genre and rating:
return {"title": title, "genre": genre, "rating": rating}
else:
return None

Choose a reason for hiding this comment

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

I like the way you did this! It's nice, easy and elegant! My one small suggestion would be what we've mentioned in class which is if you have a guard clause like what is on lines 5-6, you don't need an else statement. It's just a small change, but one less line of code is one less line of code we may have to debug!


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 functions look great!

if title == item['title']:
watched_movie.append(item)
movie_to_watchlist.remove(item)
return user_data

Choose a reason for hiding this comment

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

Because we do want the user_data to be changed as we add and remove movies from one list to the other, making two new variables to hold each individual list on lines 20-21 isn't absolutely necessary! We could just as easily replace "movie_to_watchlist" on line 23 with "user_data['watchlist']" and "watched_movie" on line 25 with "user_data['watched']". If it's easier for you to separate the lists out into their own variables however, that is totally fine and feel free to ignore my comment!

total_ratings = 0
number_movies = len(user_data["watched"])

if len(user_data["watched"]) == 0:

Choose a reason for hiding this comment

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

Great job using a guard clause that can help us avoid a Zero Division Error later on! We could also include a compound conditional here to make sure there is a user_data["watched"] list to begin with!

if len(user_data["watched"]) == 0:
return 0.0

for i in range(len(user_data["watched"])):

Choose a reason for hiding this comment

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

Don't forget you have a variable that already holds "len(user_data["watched"])!

for movie in unique_watch:
if movie not in no_duplicate_unique_watch:
no_duplicate_unique_watch.append(movie)
return no_duplicate_unique_watch

Choose a reason for hiding this comment

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

I like where you've started here! My challenge to you would be to see if there is a way you could completely remove that second loop on lines 85-87! Think about a compound conditional in an earlier part of the code! And watch those for loops!

# -----------------------------------------
# ------------- WAVE 4 --------------------
# -----------------------------------------

def get_available_recs(user_data):
available_recs = []
friends_movies_recs = get_friends_unique_watched(user_data)

Choose a reason for hiding this comment

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

Great use of a helper function here!

for i in range(len(friends_movies_recs)):
if friends_movies_recs[i]["host"] in user_data["subscriptions"]:
available_recs.append(friends_movies_recs[i])
return available_recs

Choose a reason for hiding this comment

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

Just keep watching out for those loops, but this looks good otherwise!

def get_new_rec_by_genre(user_data):
available_recs = []
friends_movies_recs = get_friends_unique_watched(user_data)
user_fav_genre = get_most_watched_genre(user_data)

Choose a reason for hiding this comment

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

Great use of helper functions again!

for i in range(len(user_data["favorites"])):
if user_data["favorites"][i] in users_watchlist:
available_recs.append(user_data["favorites"][i])
return available_recs

Choose a reason for hiding this comment

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

Same thing I've been saying before for each of these last two functions as well about the for loops, but other than that, you used helper functions really well!

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