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

Ruby - Jasmine S. and Thea V #51

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Conversation

chickenoregg
Copy link

No description provided.

Copy link

@nancy-harris nancy-harris left a comment

Choose a reason for hiding this comment

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

Excellent job! There are some comments below on places to make the code cleaner/simpler. Great job on making commits often!

Comment on lines +169 to +173
assert updated_data["watched"][0] == {
"title": MOVIE_TITLE_1,
"genre": GENRE_1,
"rating": RATING_1
}

Choose a reason for hiding this comment

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

This assert does the same thing as the three below. There's no need to check each individual key if you've already checked all of them!

# *******************************************************************************************
# ****** Add assertions here to test that the correct movie was added to "watched" **********
# *******************************************************************************************
assert updated_data["watched"][1] == movie_to_watch

Choose a reason for hiding this comment

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

Excellent!

@@ -54,13 +58,10 @@ def test_friends_unique_movies_not_duplicated():

# Assert
assert len(friends_unique_movies) == 3
assert friends_unique_movies == [FANTASY_4, HORROR_1, INTRIGUE_3]

Choose a reason for hiding this comment

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

Be careful using == for asserts on lists. If, for some reason, the movies end up in a different order, this test would fail even if all of the elements are the same. == requires that the ordering of the elements be the same as well. Instead, consider statements like assert FANTASY_4 in friends_unique_movies. That way it doesn't matter what order the list is in, as long as those movies are in the list somewhere.

@@ -86,4 +87,4 @@ def test_friends_not_unique_movies():
friends_unique_movies = get_friends_unique_watched(amandas_data)

# Assert
assert len(friends_unique_movies) == 0
assert len(friends_unique_movies) == 0

Choose a reason for hiding this comment

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

Excellent!

Comment on lines +60 to +63
result_recommendation = get_new_rec_by_genre(sonyas_data)

@pytest.mark.skip()
# Assert
assert len(result_recommendation) == 0

Choose a reason for hiding this comment

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

Excellent!

Comment on lines +90 to +91
if movie in unique_watched:
unique_watched.remove(movie)

Choose a reason for hiding this comment

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

It is more efficient to start with an empty list that we add to instead of having a full list that we remove from. The .remove() function is O(n) time. That makes this if statement O(n^2) time since the in function is also O(n). Overall, this for loop is O(m * n^2) time, where m is the length of all of the friends movies and n is the length of the user's movies.

return unique_watched


def 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.

Excellent!


# -----------------------------------------
def get_available_recs(user_data):

Choose a reason for hiding this comment

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

Excellent!


def get_new_rec_by_genre(user_data):

Choose a reason for hiding this comment

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

Excellent!

return final_recs


def get_rec_from_favorites(user_data):

Choose a reason for hiding this comment

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

Excellent!

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.

3 participants