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

Spruce - Asya S #92

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Spruce - Asya S #92

wants to merge 2 commits into from

Conversation

asya0107
Copy link

No description provided.

Copy link
Collaborator

@audreyandoy audreyandoy left a comment

Choose a reason for hiding this comment

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

Great work Asya! You hit all the learning goals for the project and passed all the tests. You definitely earned a 🟢 on this project 🌲✨

I added comments primarily on ways to refactor and reuse functions from prior waves. In the future, I'd like to see more docstrings in your functions, especially where you are using functions/methods in Python that are not covered in our curriculum.

Feel free to refactor and improve on this project and do let me know if you want me to take another look for fun 😄

Keep up the great work!

@@ -2,6 +2,7 @@

Copy link
Collaborator

Choose a reason for hiding this comment

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

This README file didn't need to be pushed. You can use commands like git add <filename> to ensure that you're only adding specific files to be tracked, committed, and pushed to Github.

Comment on lines +2 to +4
#this is the function that creates a new movie
def create_movie(title, genre, rating):

Copy link
Collaborator

Choose a reason for hiding this comment

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

I highly suggest adding docstrings underneath function signatures. The docstrings are a neat way of adding multi-line comments, especially about the functions we are building. It's also a great way of providing notes to your future self.

This same advice can be applied to the rest of the functions in this project and future projects.

Suggested change
#this is the function that creates a new movie
def create_movie(title, genre, rating):
def create_movie(title, genre, rating):
'''
this is the function that creates a new movie
'''



# function that that adds movie to watched list
def add_to_watched(user_data, movie):
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍



#add movie to movies to watch
def add_to_watchlist(user_data, movie):
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Comment on lines +45 to +55
def watch_movie(user_data,title):

# if title is a movie in user's watchlist
for movie in user_data['watchlist']:

if title == movie['title']:

user_data['watchlist'].remove(movie)
user_data['watched'].append(movie)

return user_data
Copy link
Collaborator

@audreyandoy audreyandoy Sep 22, 2021

Choose a reason for hiding this comment

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

Be careful about modifying a collection as you're iterating through it (watchlist). For this example, we're only removing a single instance of a movie, however, if there are multiple instances of that movie that could cause the rest of the items in the list to shift position and potentially skip over other items as the loop continues.

This case is fine, but let's proceed with caution when modifying a collection while iterating through it.

Copy link
Collaborator

Choose a reason for hiding this comment

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



# returns a list of movies that the friends have watched, but the user hasn't
def get_friends_unique_watched(user_data):
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Comment on lines +157 to +160
for friend in user_data['friends']:
for movie in friend['watched']:
if movie not in friend_watched:
friend_watched.append(movie)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another good place to reuse the get_friends_unique_watched() function

Comment on lines +132 to +137
friend_watched = []
user_watched_titles = []
# get to iteration over subs list and friends hosts
for friend in user_data['friends']:
for movie in friend['watched']:
friend_watched.append(movie)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would be a great place to reuse the get_friends_unique_watched() function.


# get a list of users faves
def get_rec_from_favorites(user_data):
rec_from_faves_list = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 Although this could also be a good spot to use the get_unique_watched() function.

Comment on lines +187 to +201















Copy link
Collaborator

@audreyandoy audreyandoy Sep 22, 2021

Choose a reason for hiding this comment

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

Suggested change

You don't need all of this whitespace. To make your project neater and follow pep8 guidelines, you can have VS Code autoformat your files by right-clicking on a file in VS Code and select Format Document With... then select python from the drop-down menu. You'll then be prompted to install autopep8, click yes and the package will be installed within your virtual environment.

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.

2 participants