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

Tigers - Lindsey B. #156

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

Conversation

Lindseymarcea
Copy link

No description provided.

@Lindseymarcea
Copy link
Author

My only comment is that after listening to the viewing party intro and reading the instructions I wasn't aware that all of the tests needed to be completed until speaking with Jayce and she informed me, a few days ago that I was. And was not able to complete the full viewing party in time. Test one in wave 2 also passed but did not pass this morning.

Copy link

@chimerror chimerror left a comment

Choose a reason for hiding this comment

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

Good attempt!

Unfortunately, this submission is too incomplete at this point for any other grade besides Red. At the very least, we're expecting waves 1 through 3 to be completed and at least half of wave 4. Wave 5 can be skipped. If those get done, we can move this up to a Yellow. (Obviously if they all get done, we can move to Green!)

In the future if you are facing a deadline and have not completed all waves please reach out to me before submitting an incomplete submission. I would rather grant you an extension to finish it up rather than realize that it's incomplete a week later when I got around to grading it. I could have also verified what you had done and if that would be enough for at least a Yellow. (Admittedly taking so long to get to grading is on me...)

Additionally, there are several very concerning issues and bugs in the code that suggest that you may not quite have had complete understanding of using loops and data structures, which is further reason for me to mark this Red. I've pointed these out in comments.

I also made a few smaller comments about other issues, but I want your main focus to be on getting everything working first.

As am I marking this Red, you will be expected to make another submission to fix the issues. We do have our 1:1 coming up this week, but if you would like to schedule more time to receive help on this, we can schedule that too. I will also be running Catch-up office hours at 1 PM PDT on Tuesday, which is specifically for catching up on older projects, so that might be a good time to get help with this.

I know it's rough to recieve a Red, but I'm hopeful that with some effort and help we can totally get this to Yellow if not Green! You've likely already have had more practice with your work on Adagrams this week, so hopefully some of that helps here!

tests/test_wave_01.py Outdated Show resolved Hide resolved
@@ -1,23 +1,152 @@
# ------------- WAVE 1 --------------------

#from tkinter.tix import InputOnly

Choose a reason for hiding this comment

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

Looks like an import statement that ended up not being used. Just a small style thing, it's usually worth removing these before submission to keep the code clean.

Choose a reason for hiding this comment

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

Still here after resubmission, but not really something major, so it's fine.

viewing_party/party.py Outdated Show resolved Hide resolved
viewing_party/party.py Outdated Show resolved Hide resolved
viewing_party/party.py Outdated Show resolved Hide resolved
viewing_party/party.py Outdated Show resolved Hide resolved
viewing_party/party.py Show resolved Hide resolved
else:
for i in range(len(user_data["watched"])):
genre_list.append((user_data["watched"][i] ["genre"]))
i+=1

Choose a reason for hiding this comment

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

Like the increment statement above, this increment statement will throw off your loop, causing every other item to be skipped.

Choose a reason for hiding this comment

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

This still applies in the updated code, which will definitely cause a bug.


for genre in genre_list:
count = genre_list.count(genre)
genre_dictionary[genre] = count

Choose a reason for hiding this comment

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

This works, but there is a small performance hit. Even though we hadn't covered time complexity at the time you wrote this, it will be helpful to understand what's going on.

When calling genre_list.count(genre), it will be an O(n) operation because it will go through every item in genre_list to get the count. However, since we are going through every genre in genre_list in our loop, that is also going to be an O(n) operation causing the entire loop to end up O(n^2).

While count is an incredibly useful method here, we can get this loop down to O(n) by managing genre_dictionary ourselves:

for genre in genre_list:
    if genre in genre_dictionary.keys():
        genre_dictionary[genre] += 1
    else
        genre_dictionary[genre] = 1

Choose a reason for hiding this comment

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

While the updated does use genre_dictionary note that we still hit the O(n^2) performance issue that I pointed out last time due to calling genre_list.count(genre) during each iteration of for genre in genre_list. But it's progress, so it's not too concerning.

viewing_party/party.py Outdated Show resolved Hide resolved
Copy link

@chimerror chimerror left a comment

Choose a reason for hiding this comment

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

Good Work!

Despite the fact that your wave 5 tests are failing due to a small error, the bug and performance in get_most_watched_genre still in play, and a few other small issues I pointed out, this looks good enough for a Green! Thank you so much for re-submitting, it is much improved and demonstrates good understanding of the material.


raise Exception("Test needs to be completed.")
# raise Exception("Test needs to be completed.")

Choose a reason for hiding this comment

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

As a minor style preference, I recommend just getting rid of commented out code in general unless there's a clear reason to keep it, which should be explained in a comment. This also applies to the comments below where we described how we wanted you to extend the tests, but more just in the sense of keeping code clean.

I'm sure there's a few other cases where this applies, but I'll only point it out once to avoid repeating myself.

@@ -118,13 +114,16 @@ def test_moves_movie_from_watchlist_to_empty_watched():
# Assert
assert len(updated_data["watchlist"]) == 0
assert len(updated_data["watched"]) == 1
assert updated_data["watched"][0]["title"] == MOVIE_TITLE_1
assert updated_data["watched"][0]["genre"] == GENRE_1
assert updated_data["watched"][0]["rating"] == RATING_1

Choose a reason for hiding this comment

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

Good thorough test design here!

@@ -55,12 +55,12 @@ def test_friends_unique_movies_not_duplicated():
# Assert
assert len(friends_unique_movies) == 3

raise Exception("Test needs to be completed.")
# raise Exception("Test needs to be completed.")

Choose a reason for hiding this comment

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

Not a major deal, but you were expected to expand this test a little beyond just checking the length. The main thing we want to verify is that the duplicated movie (INTRIGUE_3) is not also duplicated in the result, so something like assert friends_unique_movies.count(INTRIGUE_3) == 1 would make sense.

@@ -1,23 +1,152 @@
# ------------- WAVE 1 --------------------

#from tkinter.tix import InputOnly

Choose a reason for hiding this comment

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

Still here after resubmission, but not really something major, so it's fine.


# -----------------------------------------
new_movie = {}

Choose a reason for hiding this comment

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

Minor style thing about where you declare variables. Since we only use this new_movie variable in the if title and genre and rating block, we can move its declaration there. In this case it only saves the very minor memory allocation of an empty dictionary, but that's still worth keeping in mind.

In general, I look to delay my variable declarations to the last possible moment, which both avoids unnecessary allocations if the function exits early, and tends to make the variable declaration be as close as possible to where it is used, which means less scrolling if you need to check the declaration to understand what's happening later on.


for genre in genre_list:
count = genre_list.count(genre)
genre_dictionary[genre] = count

Choose a reason for hiding this comment

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

While the updated does use genre_dictionary note that we still hit the O(n^2) performance issue that I pointed out last time due to calling genre_list.count(genre) during each iteration of for genre in genre_list. But it's progress, so it's not too concerning.

viewing_party/party.py Show resolved Hide resolved
for movie in friend["watched"]:
if movie not in user_data["watched"] and movie["host"] in user_data["subscriptions"]:
recommended.append(movie)
return recommended

Choose a reason for hiding this comment

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

This works, but has some downsides. Mainly this would have been a good chance to reuse get_friends_unique_watched from wave 4 as a helper function. Which mainly would be nice because it will deduplicate movies unlike the implementation here.


favorite_genre = get_most_watched_genre(user_data)

for friend in user_data["friend"]:

Choose a reason for hiding this comment

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

Ah, it looks like the tests for wave 5 are partially failing because this should likely be user_data["friends"] (plural on "friends") rather than user_data["friend"].

Which of course, could have been avoided if you reused get_friends_unique_watched here as a helper function, since that function works.

for movie in user_data["favorites"]:
if movie["title"] not in friends_list:
recommended_movies.append(movie)
return recommended_movies

Choose a reason for hiding this comment

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

Despite me mentioning reusing get_friends_unique_watched in other cases, here, get_unique_watched would have likely made more sense... Unless of course we can't guarantee that any movie in user_data["favorites"] is also in user_data["watched"], which is definitely possible but seems unlikely.

If we could assume that every movie in user_data["favorites"] was also in user_data["watched"] Then we would be free to reuse get_unique_watched for slightly cleaner code.

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