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

Devin - Lions #152

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Devin - Lions #152

wants to merge 15 commits into from

Conversation

devintaylor122
Copy link

No description provided.

Copy link

@goeunpark goeunpark left a comment

Choose a reason for hiding this comment

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

Wonderful work, Devin! 🎉

I actually do want to print and frame your commit messages because they are the gold standard! ⭐ Your code also shines; I can tell that you understand nested loops, conditionals, testing and modifying lists. This project is a well-deserved Green. 🟢

Keep up the great work! 🎉

Comment on lines +122 to +124
assert updated_data["watched"][0]["title"] == MOVIE_TITLE_1
assert updated_data["watched"][0]["genre"] == GENRE_1
assert updated_data["watched"][0]["rating"] == RATING_1

Choose a reason for hiding this comment

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

Wonderful assert statements! ✨

Comment on lines 2 to +5




Choose a reason for hiding this comment

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

Small nit: remove all the unnecessary whitespace before submitting! 😉

Comment on lines +10 to +19
movie = None
if title == None or genre == None or rating == None:
movie == None
else:
movie = {
"title" : title,
"genre" : genre,
"rating" : rating
}
return movie

Choose a reason for hiding this comment

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

On L12, we check if movie is None, not reassigning movie as None. We can also get rid of the temporary variable and return directly inside the else loop, like so:

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

def watch_movie(user_data, title):
for movie in user_data["watchlist"]:
if title in movie["title"]:
user_data["watchlist"].remove(movie)

Choose a reason for hiding this comment

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

One danger of modifying the user_data while iterating is that it could cause an error in our loop. Try to avoid modifying a list while you're iterating through it!

counter = 0
average = 0.0
for movie in user_data["watched"]:
if movie["rating"] == False:

Choose a reason for hiding this comment

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

A more pythonic way to write this code is:

if not movie["rating"]:

# -----------------------------------------
# ------------- WAVE 4 --------------------
# -----------------------------------------
def get_available_recs(user_data):
unwatched_movies = 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.

Nice job using get_friends_unique_watched()! 🎉

Comment on lines +114 to +116
for movie in unwatched_movies:
if movie["host"] in user_data["subscriptions"]:
movie_recs.append(movie)

Choose a reason for hiding this comment

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

I feel like you can do this in your sleep now! 😴


# -----------------------------------------
# ------------- WAVE 5 --------------------
# -----------------------------------------
def get_new_rec_by_genre(user_data):
unwatched_movies = 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.

  • chefs kiss * 👨🏻‍🍳

unwatched_movies = get_friends_unique_watched(user_data)
movie_recs = []
for movie in unwatched_movies:
if movie["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.

The efficiency! ⭐

for movie in user_data["favorites"]:
if movie in unwatched_movies:
movie_recs.append(movie)
return movie_recs

Choose a reason for hiding this comment

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

Python likes a newline at the end of the file, otherwise Github shows a silly 🚫

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