Skip to content

C19 Digital / Amber S#69

Open
Maashad wants to merge 18 commits into
Ada-C19:mainfrom
Maashad:main
Open

C19 Digital / Amber S#69
Maashad wants to merge 18 commits into
Ada-C19:mainfrom
Maashad:main

Conversation

@Maashad

@Maashad Maashad commented Apr 1, 2023

Copy link
Copy Markdown

No description provided.

@marciaga marciaga left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job with this project! I like the frequent Git commits, good choice of variable names, and the use of helper functions!

I noticed one test was skipped in wave 03. I pulled the repo down and ran the test, which passed 🎉 but an important thing to read back over your PR before submitting to make sure everything looks correct (this is definitely true both here and very much so in industry!).

Comment thread tests/test_wave_01.py
# *******************************************************************************************
# ****** Add assertions here to test that the correct movie was added to "watched" **********
# *******************************************************************************************
assert updated_data["watched"][0]["title"] == MOVIE_TITLE_1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice job, this is exactly what you want to check!

Comment thread tests/test_wave_01.py
# *******************************************************************************************
# ****** Add assertions here to test that the correct movie was added to "watched" **********
# *******************************************************************************************
assert movie_to_watch in updated_data["watched"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job with this one!

Comment thread tests/test_wave_03.py
assert len(friends_unique_movies) == 3

raise Exception("Test needs to be completed.")
assert INTRIGUE_3 in friends_unique_movies

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job with adding these assertions as well!

Comment thread tests/test_wave_05.py
# ****** Complete the Act and Assert Portions of these tests **********
# *********************************************************************
# Assert
assert len(recommendations) == 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice, this is the same check I would write as well!

Comment thread viewing_party/party.py
if title and genre and rating:
movie = {"title": title, "genre": genre, "rating": rating}
return movie
else:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since you return from the if clause, there's no need for returning from the else here. If the if block doesn't get executed, the function will return the value from the else clause, so you can omit it and just return from the main body of the function, which will allow you to save on indentation and make for better readability!

Comment thread viewing_party/party.py
user_unique_watched = []

for movie in user_watched:
if not movie in friends_watched:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The logic in this case would work the same way, but it is more "Pythonic" to use the if not X construction.

Comment thread viewing_party/party.py

return friends_unique_watched

# def friends_movies(user_data):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No problem to leave it in this time, but generally you'll want to remove commented out code before submitting a PR.

Comment thread viewing_party/party.py
# ------------- WAVE 4 --------------------
# -----------------------------------------

def get_available_recs(user_data):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job reusing the get_friends_unique_watched function here!

Comment thread viewing_party/party.py
# ------------- WAVE 5 --------------------
# -----------------------------------------

def get_new_rec_by_genre(user_data):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job with this function!

Comment thread viewing_party/party.py
if movie in user_data["favorites"]:
rec_based_on_favorites.append(movie)
else:
rec_based_on_favorites = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No need to use this else here since you probably wouldn't want to reassign the rec_based_on_favorites variable to an empty list. We aren't testing a case that would show this bug, but it would be one like:

    test_data = {
        "favorites": [INTRIGUE_1, FANTASY_3b],
        "watched": [
            FANTASY_1b,
            ],
        "friends":  [
            {
                "watched": [
                    FANTASY_3b,
                ]
            }
        ]
    }

I think in this case, INTRIGUE_1 should be returned as a recommendation, correct? This function would return an empty list in this case. Could be something worth investigating!

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