Skip to content

Comments

Maple - Nicole W.#79

Open
N-Washington wants to merge 6 commits intoAda-C16:masterfrom
N-Washington:master
Open

Maple - Nicole W.#79
N-Washington wants to merge 6 commits intoAda-C16:masterfrom
N-Washington:master

Conversation

@N-Washington
Copy link

No description provided.

Comment on lines +2 to +11
def create_movie(title,genre,rating):
new_movie = {}
empty = None
if title and genre and rating:
new_movie["title"] = title
new_movie["genre"] = genre
new_movie["rating"] = rating
return new_movie
else:
return empty
Copy link

Choose a reason for hiding this comment

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

This works great but you could just return the title. genre, and rating without doing new_movie = {} and empty = None

Suggested change
def create_movie(title,genre,rating):
new_movie = {}
empty = None
if title and genre and rating:
new_movie["title"] = title
new_movie["genre"] = genre
new_movie["rating"] = rating
return new_movie
else:
return empty
def create_movie(title, genre, rating):
if title == None or genre == None or rating == None:
return None
else:
return {
"title":title,
"genre":genre,
"rating":rating
}

Comment on lines +14 to +15
user_list = user_data["watched"]
user_list.append(movie)
Copy link

Choose a reason for hiding this comment

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

this works great. You can also do user_data['watched'].append(movie)

user_list.append(movie)
return user_data

def add_to_watchlist(user_data,movie):
Copy link

Choose a reason for hiding this comment

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

🙌🏽

Comment on lines +22 to +29
def watch_movie(user_data,title):
watch_list = user_data["watchlist"]

for movie in watch_list:
if title in movie.values():
watched_movie = watch_list.pop()
user_data["watched"].append(watched_movie)
return user_data
Copy link

Choose a reason for hiding this comment

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

🙌🏽



##WAVE 02##
def get_watched_avg_rating(user_data):
Copy link

Choose a reason for hiding this comment

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

🙌🏽

avg_rating = sum(ratings_list) / len(ratings_list)
return float(avg_rating)

def get_most_watched_genre(user_data):
Copy link

Choose a reason for hiding this comment

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

great use of a frequency map and max method here

return most_watched

## WAVE 03 ##
def get_unique_watched(user_data):
Copy link

Choose a reason for hiding this comment

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

🙌🏽

user_unique_movies.append(movie)
return user_unique_movies

def get_friends_unique_watched(user_data):
Copy link

Choose a reason for hiding this comment

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

🙌🏽

## WAVE 04 ##
def get_available_recs(user_data):
user_subscriptions = user_data["subscriptions"]
user_watched_titles = [movie["title"] for movie in user_data["watched"]]
Copy link

Choose a reason for hiding this comment

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

ok I see you using list comprehension 💁🏽‍♀️

return friends_unique_movies

## WAVE 04 ##
def get_available_recs(user_data):
Copy link

Choose a reason for hiding this comment

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

How could you use the previously created function get_friends_unique_watched(user_data) here?

Comment on lines +103 to +104
user_most_watched = get_most_watched_genre(user_data)
user_unwatched = get_friends_unique_watched(user_data)
Copy link

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!

movie_recommendations.append(movie)
return movie_recommendations

def get_rec_from_favorites(user_data):
Copy link

Choose a reason for hiding this comment

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

🙌🏽

@tgoslee
Copy link

tgoslee commented Sep 21, 2021

Great Job! I just added some comments on places you can refactor your code and the use of helper functions!

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