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

Lauren Cardella -- Carets #24

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

Conversation

enigmagnetic
Copy link

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. The only custom method I wrote was top_work. It uses the max_by enumerable to return the work with the larges votes array.
Describe how you approached testing that model method. What edge cases did you come up with? I didn't test this method because I wasn't sure how to use vote test fixtures appropriately.
Describe an edge case test you wrote for a controller I wrote an edge case to ensure that a vote cannot be cast if no user is logged in.
What are session and flash? What is the difference between them? Session and flash are both special types of Ruby on Rails objects that act like hashes. Flash will store data into the next request, while session will store data until the browser is closed or otherwise cleared.
Describe a controller filter you wrote. I used a before_action controller filter to find the requested work for the show, edit, update, and destroy actions.
What was one thing that you gained more clarity on through this assignment? I gained clarity on the gaping holes in my Rails knowledge. This was the first time I was not able to complete the requirements for a project, and I spent more time on it than normal for a weekly project. I still don't know why my votes controller methods are not working as expected, and why I can't get the works to properly order by vote count (even after adding the counter_cache column).
What is the Heroku URL of your deployed application
Do you have any recommendations on how we could improve this project for the next cohort? The order of tasks in the waves didn't make sense. We were supposed to list things by votes before creating vote or user models, both of which are required to log votes. For me it would have also been helpful to go over possible ways to implement the voting functionality. It was not clear how to do this and researching methods was difficult and fruitless.

…rce and custom home path to routes.Add first works controller test for home.
…tion to home view. Add pseudo code for top_work to work model. Having trouble conceptualizing how to list works by votes when votes don't exist yet. Need to start a new branch for users and votes before assembling the views.
…ixrture data, and tests for work model. Getting an ActiveRecord error when trying to run my tests.
…ication_year data type from date to integer. Add works test data. All works validations tests passing.
…tests and controller methods. All tests passing.
…x page. Add content to work show view. Add show test for works controller. Add users controller, another user fixture, edit resources for users in routes, add index and show tests to users controller tests.
…o edit view. Write positive test cases, all passing.
…nks to user index page. Build out show view. Update user controller test to use fixture.
… users controller. Build login_form view. Add users controller test for login, new user, and logout. All tests passing.
…e. Define home method in works controller to return list of top ten works in each category. Build out and style home view.
… path. More style updates. 1 votes controller test not passing, but site is functioning as expected.
@tildeee
Copy link

tildeee commented Oct 22, 2017

Something fishy is happening with your project for me! When I run the tests, I get a bunch of errors about coffee_script not loading. However, if I remove the line that loads your application css and application javascript files, the errors disappears and the tests pass (with the exception of the VotesController test failure that you're aware of). The site is otherwise functional for me.
I think this is something wrong on my end, but I wanted to know if you encountered this too.

Besides voting not working, this is the only other bug I saw:

  • Editing a work with an invalid publication year doesn't seem to work (no error message)

I'm adding comments about how to fix voting for your code base, but here's the summary:
In your votes_controller, you're not finding work_id and user_id correctly, and so on the new vote, they're being set to nil, which means that saving fails.

  • You can pass in work_id a number of ways, one of them being through URL params. You can define a voting path in routes.rb as such
  post '/votes/:work_id', to: 'votes#create', as: 'votes'

and then modify the work show view to pass in the work_id as such

<%= link_to "Upvote", votes_path(@work.id), method: :post, class: "button" %>

Finally, you can update your votes_controller_test.rb to use that new path like so

post votes_path(works(:album).id)

I'm adding a separate comment about getting user_id on vote

def create
vote = Vote.new
if session[:user_id] && !already_voted
vote.user_id = params[:user_id]
Copy link

Choose a reason for hiding this comment

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

your user_id is stored on session, not params

@tildeee
Copy link

tildeee commented Oct 22, 2017

Media Ranker

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene x
Comprehension questions x
General
Rails fundamentals (RESTful routing, use of named paths) x
Semantic HTML x
Errors are reported to the user missing on invalid publication year input on work
Business logic lives in the models x
Models are thoroughly tested, including relations, validations and any custom logic validations on work
Controllers are thoroughly tested yes on all controllers, just one failing votes_controller test
Wave 1 - Media
Splash page shows the three media categories x
Basic CRUD operations on media are present and functional x
Wave 2 - Users and Votes
Users can log in and log out x
The ID of the current user is stored in the session x
Individual user pages and the user list are present x
A user cannot vote for the same media more than once can't vote
All media lists are ordered by vote count the logic is there
Splash page contains a media spotlight x
Media pages contain lists of voting users x
Wave 3 - Styling
Foundation is used appropriately x
Look and feel is similar to the original x
Overall

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