From 8e3a180acbefab2ffb898e55c8647f5c6e6cbf96 Mon Sep 17 00:00:00 2001 From: Charlie Date: Tue, 28 Mar 2023 21:27:40 -0700 Subject: [PATCH] fixed second function in wave3, adding notes written for wave 4 --- play_tester.py | 12 +++---- tests/test_wave_03.py | 12 +++++-- viewing_party/party.py | 81 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 92 insertions(+), 13 deletions(-) diff --git a/play_tester.py b/play_tester.py index 9e2aecf48..6928c964b 100644 --- a/play_tester.py +++ b/play_tester.py @@ -9,16 +9,16 @@ pp = pprint.PrettyPrinter(indent=4) # play testing section -print("\n-----Wave 01 test data-----") -pp.pprint(HORROR_1) -pp.pprint(FANTASY_1) -pp.pprint(FANTASY_2) +# print("\n-----Wave 01 test data-----") +# pp.pprint(HORROR_1) +# pp.pprint(FANTASY_1) +# pp.pprint(FANTASY_2) # 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-----") diff --git a/tests/test_wave_03.py b/tests/test_wave_03.py index 3de7be003..c54346fc2 100644 --- a/tests/test_wave_03.py +++ b/tests/test_wave_03.py @@ -3,6 +3,7 @@ from tests.test_constants import * +@pytest.mark.skip() def test_my_unique_movies(): # Arrange amandas_data = clean_wave_3_data() @@ -16,6 +17,7 @@ def test_my_unique_movies(): assert INTRIGUE_2 in amandas_unique_movies assert amandas_data == clean_wave_3_data() +@pytest.mark.skip() def test_my_not_unique_movies(): # Arrange @@ -28,7 +30,7 @@ def test_my_not_unique_movies(): # Assert assert len(amandas_unique_movies) == 0 -@pytest.mark.skip() + def test_friends_unique_movies(): # Arrange amandas_data = clean_wave_3_data() @@ -43,7 +45,7 @@ def test_friends_unique_movies(): assert FANTASY_4 in friends_unique_movies assert amandas_data == clean_wave_3_data() -@pytest.mark.skip() + def test_friends_unique_movies_not_duplicated(): # Arrange amandas_data = clean_wave_3_data() @@ -54,7 +56,11 @@ def test_friends_unique_movies_not_duplicated(): # Assert assert len(friends_unique_movies) == 3 - + assert FANTASY_4 in friends_unique_movies + assert HORROR_1 in friends_unique_movies + assert INTRIGUE_3 in friends_unique_movies + + #raise Exception("Test needs to be completed.") # ************************************************************************************************* # ****** Add assertions here to test that the correct movies are in friends_unique_movies ********** diff --git a/viewing_party/party.py b/viewing_party/party.py index 3bde4568b..34be9feb7 100644 --- a/viewing_party/party.py +++ b/viewing_party/party.py @@ -137,12 +137,85 @@ def get_most_watched_genre(user_data): # } +#wave 3 +#function 2 + + +def get_friends_unique_watched(user_data): + + 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 + +""" +does not remove duplicates + user = user_data["watched"] + friends = user_data["friends"] + + friends_list = [] + + #i = watched + for i_dict in friends: + movies_list = i_dict["watched"] + for movies_dict in movies_list: + if movies_dict not in user: + friends_list.append(movies_dict) + if key,value in friends_list["title"] + return friends_list +""" + + +#wave 4 +#function 1 + +# def get_available_recs(user_data): +# """ +# takes 1 parameter user_data +# user_data field subcscriptions +# value of subscriptions is list of string +# represents the names of ea streaming service user has access +# ea friend in friends has watched list +# ea movie in watched list has host +# host is string that says what streaming service is hosted on +# determine list of recs nmovies +# movie should be added to list only if +# user has not watched +# atleast one user friend has watched +# host of movie is service thats in users subscription +# return list of rec movies +# """ +# amandas_data = { +# "subscriptions": ["hulu", "disney+"], +# "watched": [], +# "friends": [ +# { +# "watched": [HORROR_1b] +# }, +# { +# "watched": [FANTASY_3b] +# } +# ] +# } +# #subscription ['netflix','hulu','crunchyroll'] +# friends = [friend:[movie : "host"(watched list)]] +# list_of_rec_movies = [] + +# users_subscriptions = user_data[0] +# #[friends][0][watched] +# movies add to list if +# user has not watched +# one friend has watched +# host is a service users owns +# return list_of_rec_movies + -# ----------------------------------------- -# ------------- WAVE 3 -------------------- -# ----------------------------------------- - # ----------------------------------------- # ------------- WAVE 4 -------------------- # -----------------------------------------