Skip to content

Kunzite - Gabby Y. and Allie S.#45

Open
gnyoung wants to merge 21 commits into
Ada-C19:mainfrom
azs6189:main
Open

Kunzite - Gabby Y. and Allie S.#45
gnyoung wants to merge 21 commits into
Ada-C19:mainfrom
azs6189:main

Conversation

@gnyoung

@gnyoung gnyoung commented Mar 30, 2023

Copy link
Copy Markdown

No description provided.

@spitsfire spitsfire 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, Gabby and Allie! Very clean, easy to read code! I've left a few suggestions below, but overall your logic looks good!

Comment thread viewing_party/party.py

def create_movie(title, genre, rating):
pass
if (not title) or (not genre) or (not rating):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We only need parentheses around conditional statements when we need multiple conditions to be finished first, then move on to another group. For example, if (not title or not genre) and not rating; otherwise, forgo parentheses. It's not very Pythonic.

Comment thread viewing_party/party.py
Comment on lines +11 to +14
new_movie = {}
new_movie["title"] = title
new_movie["genre"] = genre
new_movie["rating"] = rating

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This works! We can also do this all at once, too inside new_movie

Comment thread viewing_party/party.py
return new_movie


def add_to_watched(user_data, movie):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 perf

Comment thread viewing_party/party.py
return user_data


def add_to_watchlist(user_data, movie):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

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


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

👍

Comment thread viewing_party/party.py
Comment on lines +35 to +39
for movie in user_data["watchlist"]:
if title == movie["title"]:
move_movie = movie
user_data["watchlist"].remove(movie)
user_data["watched"].append(move_movie)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Careful here! We are removing items from a list while iterating through it. This can result in items being skipped over because of a shift in index positions.

How best to combat this can depend. We could make a copy of the watchlist and remove from one while we loop through the other. Or perhaps we can break once we finish line 39. But then that begs the question, what if the same movie is inside the list?

Something to think about!

Comment thread tests/test_wave_01.py
Comment on lines +178 to +183
assert updated_data["watchlist"] == []
assert updated_data["watched"] == [{
"title": MOVIE_TITLE_1,
"genre": GENRE_1,
"rating": RATING_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.

👍

Comment thread tests/test_wave_01.py
Comment on lines +209 to +212
assert updated_data["watchlist"] == [
FANTASY_1
]
assert updated_data["watched"] == [FANTASY_2, movie_to_watch]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread tests/test_wave_03.py
Comment on lines +67 to +73
assert friends_unique_movies == [
{'title': 'The Programmer: An Unexpected Stack Trace',
'genre': 'Fantasy', 'rating': 4.0},
{'title': 'It Came from the Stack Trace',
'genre': 'Horror', 'rating': 3.5},
{'title': 'Zero Dark Python', 'genre': 'Intrigue', 'rating': 3.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.

👍

Comment thread tests/test_wave_05.py
Comment on lines +64 to +68
recommendations = get_new_rec_by_genre(sonyas_data)

# Assert
assert recommendations == []
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.

👍

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