Skip to content

Sea Turtles - San Robinson#115

Open
sanzcrpt wants to merge 2 commits into
ada-c17:masterfrom
sanzcrpt:master
Open

Sea Turtles - San Robinson#115
sanzcrpt wants to merge 2 commits into
ada-c17:masterfrom
sanzcrpt:master

Conversation

@sanzcrpt
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@tgoslee tgoslee left a comment

Choose a reason for hiding this comment

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

Great job San! I left some comments on what you did well and what you can refactor. Let me know if you have any questions.

Comment thread viewing_party/party.py
Comment on lines +3 to +8
from enum import unique
from logging.handlers import RotatingFileHandler
from re import L, U
import re
from tests.test_constants import MOVIE_TITLE_1, USER_DATA_2
import copy
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Are you using all of these imports? If not, then go ahead and remove them.

Comment thread viewing_party/party.py
user_data["watchlist"].append(movie)
return user_data

def watch_movie(user_data, title):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To avoid iterating and modifying data at the same time, in this case, you could create one for loop with an if conditional that removes the movie from the watchlist and adds the movie to watched in one loop. As soon as we make a change we want to stop iterating. Here is a suggestion:

def watch_movie(user_data, title):
    for movie in user_data["watchlist"]:
        if movie["title"] == title:
            user_data["watchlist"].remove(movie)
            user_data["watched"].append(movie)
            break
    return user_data

Comment thread viewing_party/party.py
user_data["watched"].append(movie_to_watch)
return user_data

def watched_movie(user_data, title):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see that you created this helper function but you aren't using it. What were your plans to use it?

Comment thread viewing_party/party.py
user_data["watched"].append(movie_to_watch)
return user_data

def nonexistent_movie(user_data, title):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I see that you created this helper function but you aren't using it. What were your plans to use it?

Comment thread viewing_party/party.py

def get_watched_avg_rating(user_data):
avg_rating_list= []
# check_empty = []
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you can remove this if you aren't using it

Comment thread viewing_party/party.py
# get list of all friends movies(titles)
# check if each users movie is in list of movie(title)

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

you have similar lines of code in get_friends_unique_watched that would be a good candidate for helper function.

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.

🙌🏽

Comment thread viewing_party/party.py
Comment on lines +133 to +135
mode_genre = get_most_watched_genre(user_data)
new_recommendations = []
rec_recommendations = 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 helper functions here

Comment thread viewing_party/party.py



#refactored code
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would move this commented code to your notes or a txt file for your reference. You wouldn't want this to be in your final code.

Comment thread viewing_party/party.py
get_most_watched = []
if bool(user_data["watched"]) == False:
get_most_watched.append(None)
popular_genre = statistics.mode(get_most_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.

when using a method/library add a short comment on how this works on your code for readability.

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