Sapphire - Monica Lagdaan#71
Conversation
tildeee
left a comment
There was a problem hiding this comment.
Hi Monica! I know that we've worked on 4+ months of content since this project was originally assigned, so a lot of context has changed.
Anyway, great work on this project! Your code looks great. In particular, your get_new_rec_by_genre and get_rec_from_favorites implementations for the final Wave 5 are really great. I really like what your code style has developed into, because your logic is clear and efficient.
Well done! LGTM!!!
| # Assert | ||
| assert len(updated_data["watchlist"]) == 1 | ||
| assert len(updated_data["watched"]) == 2 | ||
| assert HORROR_1 == updated_data["watched"][1]["title"] |
There was a problem hiding this comment.
| assert HORROR_1 == updated_data["watched"][1]["title"] | |
| assert HORROR_1["title"] == updated_data["watched"][1]["title"] |
After looking at the definition of HORROR_1 in tests/test_constants.py, I realized that this change passes the tests!
| watchlist = user_data.get("watchlist", []) | ||
| watched = user_data.get("watched", []) |
There was a problem hiding this comment.
I like this pattern, I would keep doing this when it makes sense!
| if movie["title"] == title: | ||
| found_movie = movie | ||
| watchlist.remove(movie) | ||
| watched.append(movie) |
There was a problem hiding this comment.
Nitpick: I like how this reads since watched = user_data.get("watched", []) etc, but this is also a good opportunity to use the previous functions:
| watched.append(movie) | |
| add_to_watched(user_data, movie) |
|
|
||
| user_watched = set([movie["title"] for movie in user_data["watched"]]) | ||
| friends_list = [] | ||
|
|
||
| for friend in user_data["friends"]: | ||
| for movie in friend["watched"]: | ||
| if movie["title"] not in user_watched and movie not in friends_list: | ||
| friends_list.append(movie) | ||
|
|
||
| return friends_list |
There was a problem hiding this comment.
This is probably one of the best implementations/directions to go with this function, your code looks clean and robust, well done!
No description provided.