bbmcmann / 307MovieProject

3 stars 1 forks source link

New voting #75

Closed bbmcmann closed 1 year ago

bbmcmann commented 1 year ago

OK, so this is most of the implementation for voting. What I changed: -review schema and rout functionality to reflect voting arrays of user id's instead of vote counts -added logic to check if user has voted on a review on render -change review doc when a user votes by adding and removing them from the correct lists -added styling for voting indication -fixed rendering errors -changed review data formatting to match the db Right now, it is set up to use a test ID representing the current logged in user. I will need to use the user cookies from a future merge to get this to work for the signed in user.

To test: go to the Cars movie page. One review (should be the first) should have some upvotes and downvotes, and one of the vote arrows will be large and yellow. This indicates the user's selected vote. You can click the other arrow to see the arrow switch along with the numbers. You can see this in the DB as well by filtering reviews by movie_id: 920. it should also be open of the first reviews, you can look at the arrays to see them change. You can also console.log it to see the differences

bbmcmann commented 1 year ago

its gonna fail the review tests, which i will fix when i add the users in

jlaksana commented 1 year ago

Two comments above. You could try to pull from main to edit the test cases. Otherwise looks great. Good work and thanks for taking this on!

bbmcmann commented 1 year ago

Awesome thanks Yeah I will look at the cookeis stuff once your branch is merged, I'll open a new PR after for that. and the db values are a little out of sync since we are no longer using upvote/downvote fields anymore, just the length of the upvote_list/downvote_list arrays. I'll double check the counts.

davidh167 commented 1 year ago

Looks great! The database is updating correctly to reflect the change in upvotes/downvotes, Aside from the unsuccessful CI tests, it looks ready to merge with the main.

Thanks, for getting this stuff up and running!