Skip to content

Conversation

@CheerOnMars
Copy link

@CheerOnMars CheerOnMars commented Apr 15, 2018

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. I wrote a method to get the upvote count. In the private section of my model, I counted the upvotes.
Describe how you approached testing that model method. What edge cases did you come up with? In the test, I confirmed that the test would return the number of times that the work was voted for in the fixture. I also made sure that the test would return zero if the work didn't receive any votes.
What are session and flash? What is the difference between them? Flash sends a one time message to the view and is only up for that one time. Session keeps track of a user's date through a session and it lasts until it's actively exited out of.
Describe a controller filter you wrote. I created a controller filter to find the user so that it didn't have to be repeated in my users controller.
What was one thing that you gained more clarity on through this assignment? The magic of consistent HTML and how it makes CSS much easier
What is the Heroku URL of your deployed application? https://cheery-media-ranker.herokuapp.com/
Do you have any recommendations on how we could improve this project for the next cohort?

@CheezItMan
Copy link

Media Ranker

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Not bad, avoid commit messages like "."
Comprehension questions Check,
General
Rails fundamentals (RESTful routing, use of named paths) Mostly, you don't need a new action for upvotes. I left some notes in your code.
Semantic HTML Check, well done!
Errors are reported to the user Check, but there are some issues with creating a new work and authentication.
Business logic lives in the models Check, really nice top_ten method!
Models are thoroughly tested, including relations, validations and any custom logic Check, but you're missing tests for the custom methods.
Wave 1 - Media
Splash page shows the three media categories Check
Basic CRUD operations on media are present and functional Check
Wave 2 - Users and Votes
Users can log in and log out Check
The ID of the current user is stored in the session Check
Individual user pages and the user list are present Check
A user cannot vote for the same media more than once Check
All media lists are ordered by vote count Check
Splash page contains a media spotlight Check
Media pages contain lists of voting users Check
Wave 3 - Styling
Foundation is used appropriately Check, looks nice!
Look and feel is similar to the original Nice work, you matched the demo style pretty effectively
Overall Overall nice work, you need to work on testing more throughly and using flash notices everywhere. However you did hit the major learning goals. Slack me if you have questions.


get '/login', to: 'sessions#new', as: 'login'
post '/login', to: 'sessions#create'
get '/logout', to: 'sessions#update', as: 'logout'

Choose a reason for hiding this comment

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

I would make this route a delete action instead of get.

post '/logout', to: 'sessions#logout'

resources :works do
resources :upvotes, only: [:create, :new]

Choose a reason for hiding this comment

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

Do you need a new action for votes? Is there a form?

session[:user_id] = @user.id
flash[:success] = "Successfully logged in as existing user #{@user.username}"
else
@user = User.create username: params[:user][:username]

Choose a reason for hiding this comment

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

You should have some check to make sure that create worked properly.

<ul class="errors">
<% @work.errors.each do |column, message| %>
<li>
<strong><%= field.capitalize %></strong> <%= message %>

Choose a reason for hiding this comment

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

This is crashing the app when I try to create a work without filling in any of the fields in the form.

field should be column

Lastly you should do this with flash notices.

end

it 'must have a work' do
upvote = upvotes(:up_seventeen)

Choose a reason for hiding this comment

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

It's considered preferable to start with a valid model and then set one field to an invalid state and then check to see if that made the model invalid.

require "test_helper"

describe Work do
let(:work) { Work.new }

Choose a reason for hiding this comment

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

Similar to the upvote tests above make the work valid and then take a way a specific field to make it invalid and then test that.

work.get_upvotes_count.must_equal 0
end


Choose a reason for hiding this comment

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

Missing tests for the custom methods.

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