Skip to content

Dragonflies -- Solhee J. and Dehui H.#2

Open
ellenjin wants to merge 20 commits into
Ada-C23:mainfrom
ellenjin:main
Open

Dragonflies -- Solhee J. and Dehui H.#2
ellenjin wants to merge 20 commits into
Ada-C23:mainfrom
ellenjin:main

Conversation

@ellenjin
Copy link
Copy Markdown

No description provided.

Viktoria2609 added a commit to stellasun0332/viewing-party that referenced this pull request Mar 27, 2025
Viktoria2609 added a commit to stellasun0332/viewing-party that referenced this pull request Mar 27, 2025
@ellenjin ellenjin changed the title Dragonflies -- Solhee J. Dragonflies -- Solhee J. and Dehui H. Mar 28, 2025
Copy link
Copy Markdown

@apradoada apradoada left a comment

Choose a reason for hiding this comment

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

Overall, really well done!

First off, a couple things y'all did really well:

  1. Your code is very concise and readable and easy to understand!
  2. Y'all have some really wonderfully written list comprehensions!
  3. I loved reading through y'all's analyses of space and time complexity. Overall I think y'all are pretty spot on. When you do start to see complexities that become more like equations, it can be a good sign to either rethink your complexities or your code!

And now just a couple of overall thoughts:

  1. When it comes to docstrings and comments, balance is the hardest thing to find. They can be super useful, but they can also add a certain level of clutter, so we have to be super careful. At the end of the day, our code should be pretty self explanatory! We may need a comment here or there to explain sections of your code, and docstrings can be used for more robust functions that require a bit more explanation, but all in all don't be afraid to let your code speak for itself!

  2. Don't be afraid to write your own helper functions! Y'all are already at a pretty high level of understanding and skill. When you see functions that work similarly, you are always welcome to pick out the sections that look the same and throw them into their own functions!

Overall, y'all should be very proud of what y'all have done!

Comment thread tests/test_wave_01.py
# *******************************************************************************************
# ****** Add assertions here to test that the correct movie was added to "watched" **********
# *******************************************************************************************
assert movie 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.

This Looks good to me! Great idea to check if the whole movie is in the dictionary!

Comment on lines +23 to +24
print(result)
print(user_data_test)
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 is a really nice added test! But do make sure to remove any print statements you used for debugging purposes!

Comment thread tests/test_wave_01.py
Comment on lines +154 to +158
movie = {
"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.

It can be so useful to create an object like this for checking equality later on! Great choice!

Comment thread viewing_party/party.py
Comment on lines +13 to +14
if not title or not genre or not rating:
return None
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 is such a great pattern to follow in general! The idea to check the negative for our guard clause allows us to continue the regular running of the function!

Comment thread viewing_party/party.py
Comment on lines +15 to +19
return {
"title": title,
"genre": genre,
"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.

Tiniest little nitpick here, but traditionally, we'll keep the closing bracket for a dictionary in line with the first line it gets introduced.

Suggested change
return {
"title": title,
"genre": genre,
"rating": rating
}
return {
"title": title,
"genre": genre,
"rating": rating
}

Comment thread viewing_party/party.py
Comment on lines +129 to +132
if not user_data["watched"]:
return []
if not user_data["friends"]:
return user_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.

These are some great guard clauses!

Comment thread viewing_party/party.py
Comment on lines +163 to +171
for friend in user_data["friends"]:
if not friend["watched"]:
continue
for movie in friend["watched"]:
if not user_data["watched"] or \
(movie not in user_data["watched"] and
movie not in friends_unique_watched):
friends_unique_watched.append(movie)
return friends_unique_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 same idea as the previous function applies here! You could separate everything out into different sets and find their difference! If you want to get even fancier, you could parse out what it similar between these two functions and create a couple helper functions that can convert the user's "watched" list into a set of titles and the friends "watched" list into a different set of titles as well!

Comment thread viewing_party/party.py
Parameters: user_data(dict)
Return: list of reccomended movies(list)
"""
movies = get_friends_unique_watched(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 use of the previous function here!

Comment thread viewing_party/party.py
Return: list of reccomended movies(list)
"""
movies = get_friends_unique_watched(user_data)
return [movie for movie in 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.

This is a very well written list comprehension!

Comment thread viewing_party/party.py
Comment on lines +207 to +212
"""
Get movies from the user's most frequently watched genre which the user has
not watched, but a friend has watched.
Parameters: user_data(dict)
Return: List of reccomended movies(list)
"""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In this case and a couple others, the docstring you've included is actually longer than the function itself! In these cases, think about either shortening the docstring or removing it altogether!

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