From 052e9d1bafd11823395582532fee49843fe27b3a Mon Sep 17 00:00:00 2001 From: Maria Silva Date: Fri, 23 Sep 2022 04:26:00 -0500 Subject: [PATCH 1/5] added my name --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 187cdb442..0f2516f5f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Viewing Party +# Viewing Party - Maria ## Skills Assessed @@ -28,11 +28,11 @@ Follow these directions once, a the beginning of your project: $ cd ~/Developer/projects ``` -2. In Github click on the "Fork" button in github and fork the repository to your Github account. This will make a copy of the project in your github account. +2. In Github click on the "Fork" button in github and fork the repository to your Github account. This will make a copy of the project in your github account. ![Fork Button](images/fork.png) -3. "Clone" (download a copy of this project) into your projects folder. This command makes a new folder called `viewing-party`, and then puts the project into this new folder. Make sure you are cloning from your copy of the project and not the class version (ada-cX). +3. "Clone" (download a copy of this project) into your projects folder. This command makes a new folder called `viewing-party`, and then puts the project into this new folder. Make sure you are cloning from your copy of the project and not the class version (ada-cX). ```bash $ git clone ... @@ -92,22 +92,23 @@ $ source venv/bin/activate 2. Check the `tests` folder, and find the test file you want to run - In that test file, read through each test case - - If it is incomplete, complete the test. - - *Is this a nominal or edge case?* - - *What type of input do we need to test this case?* - - *What is the expected output for the given input?* + - If it is incomplete, complete the test. + - _Is this a nominal or edge case?_ + - _What type of input do we need to test this case?_ + - _What is the expected output for the given input?_ - Remove the lines that contain `@pytest.mark.skip()` for the test(s) you want to run. 3. Run the test(s)! - - *See the [Details About How to Run Tests](#details-about-how-to-run-tests) section below for more information on how to run test(s).* + - _See the [Details About How to Run Tests](#details-about-how-to-run-tests) section below for more information on how to run test(s)._ ```bash # Must be in activated virtual environment in the project-root directory $ pytest ``` -4. Read through the test failure, and understand why the failure is happening. Confirm your findings with a classmate. - - If it is a test you wrote, consider whether you are actually testing what you intend to test. Does the test need modification? +4. Read through the test failure, and understand why the failure is happening. Confirm your findings with a classmate. + + - If it is a test you wrote, consider whether you are actually testing what you intend to test. Does the test need modification? 5. Make a plan to implement code to pass the test. @@ -122,8 +123,9 @@ $ pytest 10. Consider looking for opportunities to improve your code. 11. Before moving to the next wave, make sure you haven't missed any skipped tests. - - *Search the file (**Cmd** **F**) for `@pytest.mark.skip`* - - *To search all files in the project, use **Cmd** **Shift** **F*** + + - _Search the file (**Cmd** **F**) for `@pytest.mark.skip`_ + - \*To search all files in the project, use **Cmd** **Shift** **F\*** 12. Begin using the test file of the next wave! @@ -135,8 +137,6 @@ $ deactivate Finally, at submission time, **no matter where you are**, submit the project via Learn. - - This will let us give feedback on what you've finished so that you can be better prepared for the next project. ## Details About How to Run Tests @@ -186,13 +186,13 @@ To run this file, use: python3 play_tester.py ``` -There is some starter code provided in `play_tester.py`. This code prints the test data that is used for many of the tests. Looking closely at this data can help us think critically about the expected output for given input for each function. Then, calling each function with this data allows us to observe the **actual** output for given input. +There is some starter code provided in `play_tester.py`. This code prints the test data that is used for many of the tests. Looking closely at this data can help us think critically about the expected output for given input for each function. Then, calling each function with this data allows us to observe the **actual** output for given input. ## Test Data -We will note that much of the test data for this project is provided by the file `test_constants.py`. As test data gets more and more complex, it is helpful to organize this data in its own file to enhance consistency and readability. Pytest, like many testing libraries, provide a special too for test data called **fixtures**. We will learn about fixtures later in the curriculum. +We will note that much of the test data for this project is provided by the file `test_constants.py`. As test data gets more and more complex, it is helpful to organize this data in its own file to enhance consistency and readability. Pytest, like many testing libraries, provide a special too for test data called **fixtures**. We will learn about fixtures later in the curriculum. -For the time being, we need to make sure that the data provided to each test is clean and free of any changes that running another test may have introduced. Recall the *Modifying Mutable Objects* section of the *Variables Are References lesson.* To ensure that the data for each test is storied in a unique place in memory, there are functions implemented in `test_constants.py` that provide clean test data (i.e. `clean_wave_3_data`) by using `copy.deepcopy`. +For the time being, we need to make sure that the data provided to each test is clean and free of any changes that running another test may have introduced. Recall the _Modifying Mutable Objects_ section of the _Variables Are References lesson._ To ensure that the data for each test is storied in a unique place in memory, there are functions implemented in `test_constants.py` that provide clean test data (i.e. `clean_wave_3_data`) by using `copy.deepcopy`. ## Project Directions @@ -202,7 +202,7 @@ When our test failures leave us confused and stuck, let's use the detailed proje ### Wave 1 -1. Create a function named `create_movie`. This function and all subsequent functions should be in `party.py`. `create_movie` should... +1. Create a function named `create_movie`. This function and all subsequent functions should be in `party.py`. `create_movie` should... - take three parameters: `title`, `genre`, `rating` - If those three attributes are truthy, then return a dictionary. This dictionary should... @@ -320,7 +320,7 @@ Note: For Waves 2, 3, 4, and 5, your implementation of each of the functions sho ### Wave 5 -1. Create a function named `get_new_rec_by_genre`. This function should... +1. Create a function named `get_new_rec_by_genre`. This function should... - take one parameter: `user_data` - Consider the user's most frequently watched genre. Then, determine a list of recommended movies. A movie should be added to this list if and only if: @@ -329,7 +329,7 @@ Note: For Waves 2, 3, 4, and 5, your implementation of each of the functions sho - The `"genre"` of the movie is the same as the user's most frequent genre - Return the list of recommended movies -2. Create a function named `get_rec_from_favorites`. This function should... +2. Create a function named `get_rec_from_favorites`. This function should... - take one parameter: `user_data` - `user_data` will have a field `"favorites"`. The value of `"favorites"` is a list of movie dictionaries From 3211549ebb5a6e3c4b0a02d4443ba5fc47b7e0ee Mon Sep 17 00:00:00 2001 From: Maria Silva Date: Fri, 23 Sep 2022 11:42:52 -0500 Subject: [PATCH 2/5] created add_to_watched and add_to_watchlist functions --- tests/test_wave_01.py | 4 ++-- viewing_party/party.py | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tests/test_wave_01.py b/tests/test_wave_01.py index 6be6994a5..bd1c2c096 100644 --- a/tests/test_wave_01.py +++ b/tests/test_wave_01.py @@ -4,7 +4,7 @@ from viewing_party.party import * from tests.test_constants import * -@pytest.mark.skip() +# @pytest.mark.skip() def test_create_successful_movie(): # Arrange movie_title = MOVIE_TITLE_1 @@ -19,7 +19,7 @@ def test_create_successful_movie(): assert new_movie["genre"] == GENRE_1 assert new_movie["rating"] == pytest.approx(RATING_1) -@pytest.mark.skip() +# @pytest.mark.skip() def test_create_no_title_movie(): # Arrange movie_title = None diff --git a/viewing_party/party.py b/viewing_party/party.py index 6d34a6b5f..87ab9b05b 100644 --- a/viewing_party/party.py +++ b/viewing_party/party.py @@ -1,8 +1,25 @@ # ------------- WAVE 1 -------------------- - def create_movie(title, genre, rating): - pass + new_movie = {} + if len(title) > 0: + new_movie["title"] = title + if len(genre) > 0: + new_movie["genre"] = genre + if rating: + new_movie["rating"] = rating + return new_movie + else: + return None + else: + return None + +def add_to_watched(user_data, movie): + user_data["watched"].append(movie) + return user_data +def add_to_watchlist(user_data, movie): + user_data["watchlist"].append(movie) + return user_data # ----------------------------------------- # ------------- WAVE 2 -------------------- # ----------------------------------------- From 1552bd973ba80569e05bd5a9e6a3c531c6e46de8 Mon Sep 17 00:00:00 2001 From: Maria Silva Date: Mon, 26 Sep 2022 21:31:41 -0500 Subject: [PATCH 3/5] wave 1 completed --- tests/test_wave_01.py | 23 ++++++++++++----------- viewing_party/party.py | 26 ++++++++++++++++++++------ 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/tests/test_wave_01.py b/tests/test_wave_01.py index bd1c2c096..3f110b3c9 100644 --- a/tests/test_wave_01.py +++ b/tests/test_wave_01.py @@ -32,7 +32,7 @@ def test_create_no_title_movie(): # Assert assert new_movie is None -@pytest.mark.skip() +# @pytest.mark.skip() def test_create_no_genre_movie(): # Arrange movie_title = "Title A" @@ -45,7 +45,7 @@ def test_create_no_genre_movie(): # Assert assert new_movie is None -@pytest.mark.skip() +# @pytest.mark.skip() def test_create_no_rating_movie(): # Arrange movie_title = "Title A" @@ -58,7 +58,7 @@ def test_create_no_rating_movie(): # Assert assert new_movie is None -@pytest.mark.skip() +# @pytest.mark.skip() def test_adds_movie_to_user_watched(): # Arrange movie = { @@ -79,7 +79,7 @@ def test_adds_movie_to_user_watched(): assert updated_data["watched"][0]["genre"] == GENRE_1 assert updated_data["watched"][0]["rating"] == RATING_1 -@pytest.mark.skip() +# @pytest.mark.skip() def test_adds_movie_to_user_watchlist(): # Arrange movie = { @@ -100,7 +100,7 @@ def test_adds_movie_to_user_watchlist(): assert updated_data["watchlist"][0]["genre"] == GENRE_1 assert updated_data["watchlist"][0]["rating"] == RATING_1 -@pytest.mark.skip() +# @pytest.mark.skip() def test_moves_movie_from_watchlist_to_empty_watched(): # Arrange janes_data = { @@ -119,15 +119,16 @@ def test_moves_movie_from_watchlist_to_empty_watched(): assert len(updated_data["watchlist"]) == 0 assert len(updated_data["watched"]) == 1 - raise Exception("Test needs to be completed.") + # raise Exception("Test needs to be completed.") # ******************************************************************************************* # ****** Add assertions here to test that the correct movie was added to "watched" ********** # ******************************************************************************************* - -@pytest.mark.skip() + assert updated_data["watched"][0]["title"] == MOVIE_TITLE_1 +# @pytest.mark.skip() def test_moves_movie_from_watchlist_to_watched(): # Arrange movie_to_watch = HORROR_1 + janes_data = { "watchlist": [ FANTASY_1, @@ -143,12 +144,12 @@ def test_moves_movie_from_watchlist_to_watched(): assert len(updated_data["watchlist"]) == 1 assert len(updated_data["watched"]) == 2 - raise Exception("Test needs to be completed.") + # raise Exception("Test needs to be completed.") # ******************************************************************************************* # ****** Add assertions here to test that the correct movie was added to "watched" ********** # ******************************************************************************************* - -@pytest.mark.skip() + assert updated_data["watched"][1] == HORROR_1 +# @pytest.mark.skip() def test_does_nothing_if_movie_not_in_watchlist(): # Arrange movie_to_watch = HORROR_1 diff --git a/viewing_party/party.py b/viewing_party/party.py index 87ab9b05b..5dce92e06 100644 --- a/viewing_party/party.py +++ b/viewing_party/party.py @@ -1,17 +1,20 @@ # ------------- WAVE 1 -------------------- def create_movie(title, genre, rating): new_movie = {} - if len(title) > 0: + if title != None: new_movie["title"] = title - if len(genre) > 0: + if genre != None: new_movie["genre"] = genre - if rating: + if rating != None: new_movie["rating"] = rating return new_movie else: return None + else: + return None else: return None + def add_to_watched(user_data, movie): user_data["watched"].append(movie) @@ -20,11 +23,23 @@ def add_to_watched(user_data, movie): def add_to_watchlist(user_data, movie): user_data["watchlist"].append(movie) return user_data + +def watch_movie(user_data, title): + for i in range(len(user_data["watchlist"])): + if title == user_data["watchlist"][i]["title"]: + user_data["watched"].append(user_data["watchlist"][i]) + user_data["watchlist"].pop(i) + + return user_data + # else: + return user_data + + + # ----------------------------------------- # ------------- WAVE 2 -------------------- # ----------------------------------------- - # ----------------------------------------- # ------------- WAVE 3 -------------------- # ----------------------------------------- @@ -36,5 +51,4 @@ def add_to_watchlist(user_data, movie): # ----------------------------------------- # ------------- WAVE 5 -------------------- -# ----------------------------------------- - +# ----------------------------------------- \ No newline at end of file From 3415d613e0a775c276c05f3234284b681c396481 Mon Sep 17 00:00:00 2001 From: Maria Silva Date: Mon, 26 Sep 2022 22:16:19 -0500 Subject: [PATCH 4/5] wave 2 completed --- tests/test_wave_02.py | 8 ++++---- viewing_party/party.py | 28 ++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/tests/test_wave_02.py b/tests/test_wave_02.py index 3a588299e..198e395b3 100644 --- a/tests/test_wave_02.py +++ b/tests/test_wave_02.py @@ -2,7 +2,7 @@ from viewing_party.party import * from tests.test_constants import * -@pytest.mark.skip() +# @pytest.mark.skip() def test_calculates_watched_average_rating(): # Arrange janes_data = clean_wave_2_data() @@ -14,7 +14,7 @@ def test_calculates_watched_average_rating(): assert average == pytest.approx(3.58333) assert janes_data == clean_wave_2_data() -@pytest.mark.skip() +# @pytest.mark.skip() def test_empty_watched_average_rating_is_zero(): # Arrange janes_data = { @@ -27,7 +27,7 @@ def test_empty_watched_average_rating_is_zero(): # Assert assert average == pytest.approx(0.0) -@pytest.mark.skip() +# @pytest.mark.skip() def test_most_watched_genre(): # Arrange janes_data = clean_wave_2_data() @@ -39,7 +39,7 @@ def test_most_watched_genre(): assert popular_genre == "Fantasy" assert janes_data == clean_wave_2_data() -@pytest.mark.skip() +# @pytest.mark.skip() def test_genre_is_None_if_empty_watched(): # Arrange janes_data = { diff --git a/viewing_party/party.py b/viewing_party/party.py index 5dce92e06..c8e057c95 100644 --- a/viewing_party/party.py +++ b/viewing_party/party.py @@ -31,15 +31,39 @@ def watch_movie(user_data, title): user_data["watchlist"].pop(i) return user_data - # else: return user_data - + # ----------------------------------------- # ------------- WAVE 2 -------------------- # ----------------------------------------- +def get_watched_avg_rating(user_data): + if len(user_data["watched"]) >= 1: + sum = 0 + for i in range(len(user_data["watched"])): + sum += user_data["watched"][i]["rating"] + return sum / len(user_data["watched"]) + else: + return 0.0 +def get_most_watched_genre(user_data): + if len(user_data["watched"]) >= 1: + genre_list = [] + for i in range(len(user_data["watched"])): + genre_list.append(user_data["watched"][i]["genre"]) + + counter = 0 + most_frequent_genre = genre_list[0] + for i in genre_list: + curr_frequency = genre_list.count(i) + if(curr_frequency> counter): + counter = curr_frequency + most_frequent_genre = i + + return most_frequent_genre + else: + return None # ----------------------------------------- # ------------- WAVE 3 -------------------- # ----------------------------------------- From b461bef48046bafc36f8d78ad7966126911b0880 Mon Sep 17 00:00:00 2001 From: Maria Silva Date: Tue, 27 Sep 2022 02:58:40 -0500 Subject: [PATCH 5/5] wave 3, 4, and 5 completed --- play_tester.py | 8 ++-- tests/test_wave_03.py | 14 +++---- tests/test_wave_04.py | 6 +-- tests/test_wave_05.py | 18 +++++---- viewing_party/party.py | 86 +++++++++++++++++++++++++++++++++++++++++- 5 files changed, 109 insertions(+), 23 deletions(-) diff --git a/play_tester.py b/play_tester.py index 9e2aecf48..e6f1f76e4 100644 --- a/play_tester.py +++ b/play_tester.py @@ -17,12 +17,12 @@ # print("\n-----Wave 02 user_data-----") # pp.pprint(clean_wave_2_data()) -#print("\n-----Wave 03 user_data-----") -#pp.pprint(clean_wave_3_data()) +# print("\n-----Wave 03 user_data-----") +# pp.pprint(clean_wave_3_data()) # Wave 04 user data -#print("\n-----Wave 04 user_data-----") -#pp.pprint(clean_wave_4_data()) +print("\n-----Wave 04 user_data-----") +pp.pprint(clean_wave_4_data()) # Wave 05 user data #print("\n-----Wave 05 user_data-----") diff --git a/tests/test_wave_03.py b/tests/test_wave_03.py index 046429360..d73c941fe 100644 --- a/tests/test_wave_03.py +++ b/tests/test_wave_03.py @@ -2,7 +2,7 @@ from viewing_party.party import * from tests.test_constants import * -@pytest.mark.skip() +# @pytest.mark.skip() def test_my_unique_movies(): # Arrange amandas_data = clean_wave_3_data() @@ -16,7 +16,7 @@ def test_my_unique_movies(): assert INTRIGUE_2 in amandas_unique_movies assert amandas_data == clean_wave_3_data() -@pytest.mark.skip() +# @pytest.mark.skip() def test_my_not_unique_movies(): # Arrange amandas_data = clean_wave_3_data() @@ -28,7 +28,7 @@ def test_my_not_unique_movies(): # Assert assert len(amandas_unique_movies) == 0 -@pytest.mark.skip() +# @pytest.mark.skip() def test_friends_unique_movies(): # Arrange amandas_data = clean_wave_3_data() @@ -43,7 +43,7 @@ def test_friends_unique_movies(): assert FANTASY_4 in friends_unique_movies assert amandas_data == clean_wave_3_data() -@pytest.mark.skip() +# @pytest.mark.skip() def test_friends_unique_movies_not_duplicated(): # Arrange amandas_data = clean_wave_3_data() @@ -55,12 +55,12 @@ def test_friends_unique_movies_not_duplicated(): # Assert assert len(friends_unique_movies) == 3 - raise Exception("Test needs to be completed.") + # raise Exception("Test needs to be completed.") # ************************************************************************************************* # ****** Add assertions here to test that the correct movies are in friends_unique_movies ********** # ************************************************************************************************** - -@pytest.mark.skip() + assert friends_unique_movies[2] == INTRIGUE_3 +# @pytest.mark.skip() def test_friends_not_unique_movies(): # Arrange amandas_data = { diff --git a/tests/test_wave_04.py b/tests/test_wave_04.py index 499669077..0b0b3c7e2 100644 --- a/tests/test_wave_04.py +++ b/tests/test_wave_04.py @@ -2,7 +2,7 @@ from viewing_party.party import * from tests.test_constants import * -@pytest.mark.skip() +# @pytest.mark.skip() def test_get_available_friend_rec(): # Arrange amandas_data = clean_wave_4_data() @@ -16,7 +16,7 @@ def test_get_available_friend_rec(): assert FANTASY_4b in recommendations assert amandas_data == clean_wave_4_data() -@pytest.mark.skip() +# @pytest.mark.skip() def test_no_available_friend_recs(): # Arrange amandas_data = { @@ -38,7 +38,7 @@ def test_no_available_friend_recs(): # Assert assert len(recommendations) == 0 -@pytest.mark.skip() +# @pytest.mark.skip() def test_no_available_friend_recs_watched_all(): # Arrange amandas_data = { diff --git a/tests/test_wave_05.py b/tests/test_wave_05.py index 85ebb8b18..e786a0ae4 100644 --- a/tests/test_wave_05.py +++ b/tests/test_wave_05.py @@ -2,7 +2,7 @@ from viewing_party.party import * from tests.test_constants import * -@pytest.mark.skip() +# @pytest.mark.skip() def test_new_genre_rec(): # Arrange sonyas_data = clean_wave_5_data() @@ -17,7 +17,7 @@ def test_new_genre_rec(): assert FANTASY_4b in recommendations assert sonyas_data == clean_wave_5_data() -@pytest.mark.skip() +# @pytest.mark.skip() def test_new_genre_rec_from_empty_watched(): # Arrange sonyas_data = { @@ -38,7 +38,7 @@ def test_new_genre_rec_from_empty_watched(): # Assert assert len(recommendations) == 0 -@pytest.mark.skip() +# @pytest.mark.skip() def test_new_genre_rec_from_empty_friends(): # Arrange sonyas_data = { @@ -53,12 +53,14 @@ def test_new_genre_rec_from_empty_friends(): ] } - raise Exception("Test needs to be completed.") + # raise Exception("Test needs to be completed.") # ********************************************************************* # ****** Complete the Act and Assert Portions of theis tests ********** # ********************************************************************* - -@pytest.mark.skip() + # Act + recommendations = get_new_rec_by_genre(sonyas_data) + assert len(recommendations) == 0 +# @pytest.mark.skip() def test_unique_rec_from_favorites(): # Arrange sonyas_data = clean_wave_5_data() @@ -72,7 +74,7 @@ def test_unique_rec_from_favorites(): assert INTRIGUE_2b in recommendations assert sonyas_data == clean_wave_5_data() -@pytest.mark.skip() +# @pytest.mark.skip() def test_unique_from_empty_favorites(): # Arrange sonyas_data = { @@ -94,7 +96,7 @@ def test_unique_from_empty_favorites(): # Assert assert len(recommendations) == 0 -@pytest.mark.skip() +# @pytest.mark.skip() def test_new_rec_from_empty_friends(): # Arrange sonyas_data = { diff --git a/viewing_party/party.py b/viewing_party/party.py index c8e057c95..16b897d81 100644 --- a/viewing_party/party.py +++ b/viewing_party/party.py @@ -1,4 +1,7 @@ # ------------- WAVE 1 -------------------- +from platform import libc_ver + + def create_movie(title, genre, rating): new_movie = {} if title != None: @@ -67,12 +70,93 @@ def get_most_watched_genre(user_data): # ----------------------------------------- # ------------- WAVE 3 -------------------- # ----------------------------------------- +def get_unique_watched(user_data): + my_movies_watched = [] + for movie in user_data["watched"]: + my_movies_watched.append(movie) + + friend_movies = [] + for friend in user_data["friends"]: + for movie in friend["watched"]: + friend_movies.append(movie) + + unique_movies = [] + + for movie in my_movies_watched: + if movie not in friend_movies and movie not in unique_movies: + unique_movies.append(movie) + + return unique_movies + +def get_friends_unique_watched(user_data): + my_movies_watched = [] + for movie in user_data["watched"]: + my_movies_watched.append(movie) + + friend_movies = [] + for friend in user_data["friends"]: + for movie in friend["watched"]: + friend_movies.append(movie) + + unique_movies = [] + for movie in friend_movies: + if movie not in my_movies_watched and movie not in unique_movies: + unique_movies.append(movie) + return unique_movies # ----------------------------------------- # ------------- WAVE 4 -------------------- # ----------------------------------------- +def get_available_recs(user_data): + recommended_movies = [] + my_movies_watched = [] + for movie in user_data["watched"]: + my_movies_watched.append(movie) + + friend_movies = [] + for friend in user_data["friends"]: + for movie in friend["watched"]: + friend_movies.append(movie) + + for movie in friend_movies: + if movie not in my_movies_watched and movie not in recommended_movies: + if movie["host"] in user_data["subscriptions"]: + recommended_movies.append(movie) + + return recommended_movies # ----------------------------------------- # ------------- WAVE 5 -------------------- -# ----------------------------------------- \ No newline at end of file +# ----------------------------------------- +def get_new_rec_by_genre(user_data): + my_movies_watched = [] + for movie in user_data["watched"]: + my_movies_watched.append(movie) + + friend_movies = [] + for friend in user_data["friends"]: + for movie in friend["watched"]: + friend_movies.append(movie) + + recommended_by_genre = [] + + user_popular_genre = get_most_watched_genre(user_data) + for movie in friend_movies: + if movie["genre"] == user_popular_genre: + if movie not in my_movies_watched and movie not in recommended_by_genre: + recommended_by_genre.append(movie) + + return recommended_by_genre + +def get_rec_from_favorites(user_data): + friend_movies = [] + for friend in user_data["friends"]: + for movie in friend["watched"]: + friend_movies.append(movie) + from_favorite_recommendation = [] + for movie in user_data["favorites"]: + if movie not in friend_movies and movie not in from_favorite_recommendation: + from_favorite_recommendation.append(movie) + + return from_favorite_recommendation