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

ports - sav #36

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

ports - sav #36

wants to merge 57 commits into from

Conversation

qqdipps
Copy link

@qqdipps qqdipps commented Apr 29, 2019

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. class methods for top_ten and spotlight in work, also private helper method for those sort work by votes.
Describe how you approached testing that model method. What edge cases did you come up with? I kept with the validation, relationship, custom method breakdown for each model. Edge case for top_ten includes if no works in db and less than 10 works in db.
What are session and flash? What is the difference between them? Session and flash are both hash like structures that are stored in rails and involve cookie. The main difference is that flash persists for a single response/request cycle while session persists for many.
What was one thing that you gained more clarity on through this assignment? I gained more clarity on complex relationships in db, thinking about design and how it can be extended. I feel like I did lots of cut and paste in my views and could dry them up using view helpers. Also explored different work flow.
What is the Heroku URL of your deployed application? https://trello.com/b/8A6CUAJP/mediaranker https://green-media-ranker.herokuapp.com/
Do you have any recommendations on how we could improve this project for the next cohort? can't think of any right now, but I'll update this if I think of anything =).

@CheezItMan
Copy link

Media Ranker

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good number of commits and good commit messages
Comprehension questions Check
General
Rails fundamentals (RESTful routing, use of named paths) Check
Views are well-organized (DRY, use of semantic HTML, use of partials) Check
Errors are reported to the user Check, although double voting does
Business logic lives in the models Sure, for the most part, see my inline notes on adding an upvote to the models.
Models are thoroughly tested, including relations, validations and any custom logic Pretty good model testing
Controllers are thoroughly tested, including the login/logout process and multi-step workflows like voting for a work You've got some problems with your update action in the works controller.
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
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
Wave 3 - Users and Votes
Media pages contain lists of voting users Check
Individual user pages and the user list are present Check
Optional - Styling
Bootstrap is used appropriately Check
Look and feel is similar to the original Looks great!
Overall Nice work, you hit all the learning goals for the project. You do need to check out my comments in the Works_controler_test.rb file. You didn't actually test the update action. Other than that, really great!

end

describe "relations" do
it "will have 0 votes" do

Choose a reason for hiding this comment

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

probably should be it "can have 0 votes" do

belongs_to :user
belongs_to :work

validates :user, presence: true, uniqueness: { scope: [:work] }

Choose a reason for hiding this comment

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

Nice!

render :login_form, status: :bad_request
end
end
if @user.valid?

Choose a reason for hiding this comment

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

This if statement seems a little extra, maybe if you had an earlier return when the user isn't valid you wouldn't need this if.

@@ -0,0 +1,22 @@
class VotesController < ApplicationController
def create

Choose a reason for hiding this comment

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

Take a look at how big this method is. I suggest creating a method upvote on the work or user model. That might help you simplify this method a bit.

@@ -0,0 +1,70 @@
class WorksController < ApplicationController
before_action :find_work, except: [:index, :new, :create]

Choose a reason for hiding this comment

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

Nice a filter!

@work.destroy
redirect_to root_path
else
head :not_found

Choose a reason for hiding this comment

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

Maybe instead of head now we should do a redirect with an error message to the user with flash.

let(:user) { users(:three) }
let(:work) { works(:one) }
describe "Votes#create" do
it "will create a vote if logged in" do

Choose a reason for hiding this comment

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

You need a test for the action if they're not logged in, and a test for a duplicate vote

category: "book",
id: work.id } }
expect {
post works_path, params: work_param

Choose a reason for hiding this comment

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

Wait a minute! this is a post request not a patch!!!!!!

id: work.id } }
expect {
post works_path, params: work_param
}.must_change "Work.count", 1

Choose a reason for hiding this comment

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

Also update shouldn't be changing the count of works!

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