Sea_Turtles_Ashley_Benson#116
Conversation
anselrognlie
left a comment
There was a problem hiding this comment.
Nice job!
All your tests are passing, and your code is nicely structured, and makes good re-use of functions from earlier waves. Nice custom helper function as well!
We'll start looking more at performance and efficiency going ahead, so I included some thoughts there as well.
Make sure to review the tests. There were a couple that had instructions about things to add that it looks like were missed. So while getting those green checks in VSCode feels great, make sure to review their implementation as there will occasionally be parts to fill in.
Well done!
| assert updated_data["watched"][0]["title"] is MOVIE_TITLE_1 | ||
| assert updated_data["watched"][0]["genre"] is GENRE_1 | ||
| assert updated_data["watched"][0]["rating"] is RATING_1 |
There was a problem hiding this comment.
It was our bad shipping with these is comparisons. For this project, the is string checks should be ok, but in general, is is mostly used to check for None. Its purpose is to check whether two objects are the same object, while == checks whether the values of two objects are the same.
| @@ -123,7 +123,7 @@ def test_moves_movie_from_watchlist_to_empty_watched(): | |||
| # ****** Add assertions here to test that the correct movie was added to "watched" ********** | |||
There was a problem hiding this comment.
Note that this test is incomplete. It checks a few assertions, but should also check that the movie in the moved list is as expected.
| @@ -146,7 +146,7 @@ def test_moves_movie_from_watchlist_to_watched(): | |||
| # ****** Add assertions here to test that the correct movie was added to "watched" ********** | |||
There was a problem hiding this comment.
Note that this test is incomplete. It checks a few assertions, but should also check that the new movie in the moved list is as expected.
| @@ -59,7 +59,7 @@ def test_friends_unique_movies_not_duplicated(): | |||
| # ****** Add assertions here to test that the correct movies are in friends_unique_movies ********** | |||
There was a problem hiding this comment.
Note that this test is incomplete. It checks a few assertions, but should also check for the correct movies in the result.
| @@ -57,7 +57,7 @@ def test_new_genre_rec_from_empty_friends(): | |||
| # ****** Complete the Act and Assert Portions of theis tests ********** | |||
There was a problem hiding this comment.
Note that this test is incomplete. It only defines some data, but has no act or assert. Pytest assumes that any test that raises no errors is a passing test, which is why this "passed." But it's not actually doing anything.
| # ------------- WAVE 4 -------------------- | ||
| # ----------------------------------------- | ||
|
|
||
| def get_available_recs(user_data): |
| def get_available_recs(user_data): | ||
| users_data = user_data | ||
| recommended_movies = [] | ||
| friends_unique_watched = get_friends_unique_watched(user_data) |
There was a problem hiding this comment.
Nice reuse of functions from wave 3!
| # ------------- WAVE 5 -------------------- | ||
| # ----------------------------------------- | ||
|
|
||
| def get_new_rec_by_genre(user_data): |
| def get_new_rec_by_genre(user_data): | ||
|
|
||
| users_data = user_data | ||
| new_rec_by_genre = [] | ||
| most_watched_genre = get_most_watched_genre(users_data) | ||
| friends_unique_watched = get_friends_unique_watched(users_data) | ||
|
|
||
| for movie in friends_unique_watched: | ||
| if movie["genre"] == most_watched_genre: | ||
| new_rec_by_genre.append(movie) | ||
|
|
||
| return new_rec_by_genre | ||
|
|
||
|
|
||
| def get_rec_from_favorites(user_data): | ||
|
|
||
| users_data = user_data | ||
| favorites = users_data["favorites"] | ||
| recommend = [] | ||
| friends_watched_movies = friends_watched(users_data) | ||
|
|
||
| for movie in favorites: | ||
| if movie not in friends_watched_movies: | ||
| recommend.append(movie) | ||
| return recommend | ||
|
|
There was a problem hiding this comment.
It looks like your wave 5 functions got duplicated here.
| friends_watched_movies = friends_watched(users_data) | ||
|
|
||
| for movie in favorites: | ||
| if movie not in friends_watched_movies: | ||
| recommend.append(movie) | ||
| return recommend |
There was a problem hiding this comment.
This approach starts from the favorite movies list, and only recommends it if it's not in the list of movies watched by the friends. An alternative approach would be to start from the unique user's watched movies, and only recommend a movie it it appears in the user's favorite list. And for either approach, we could use title sets to improve the performance of lookups (compared to in on a list).
No description provided.