Skip to content

Maryam - Media Ranker #38

Open
marshi23 wants to merge 23 commits intoAda-C10:masterfrom
marshi23:master
Open

Maryam - Media Ranker #38
marshi23 wants to merge 23 commits intoAda-C10:masterfrom
marshi23:master

Conversation

@marshi23
Copy link

@marshi23 marshi23 commented Oct 15, 2018

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. I created an upvote(user) method in my works model to create a vote for that work.
Describe how you approached testing that model method. What edge cases did you come up with? I tested the amount of votes for a work before it is has a vote. The I call the upvote method on the work and then check to see that a vote has been added to the works votes.
What are session and flash? What is the difference between them? Both are hash like objects that rails makes a available to us. Flash is used to send one time messages from the controller to the view. Sessions save data about the users until the browser is closed then the details are automatically deleted, it is usually used to keep a user logged in.
Describe a controller filter you wrote. I used a before_action controller filter in my works controller to run the find_work method before my :show, :edit, :update, :upvote, :destroy actions.
What was one thing that you gained more clarity on through this assignment? Using ActiveRecord methods, model testing and rendering views for the styling I need.
What is the Heroku URL of your deployed application? https://mcmediaranker.herokuapp.com/
Do you have any recommendations on how we could improve this project for the next cohort?
The timing and workload felt more balanced on this project.

@dHelmgren
Copy link

Media Ranker

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good!
Comprehension questions Good!
General
Rails fundamentals (RESTful routing, use of named paths)
Views are well-organized (DRY, use of semantic HTML, use of partials)
Errors are reported to the user yes, but some are incorrect, see comments.
Business logic lives in the models yes
Models are thoroughly tested, including relations, validations and any custom logic Yes!
Wave 1 - Media
Splash page shows the three media categories Yes
Basic CRUD operations on media are present and functional Mixed bag, see comments!
Wave 2 - Users and Votes
Users can log in and log out Yes
The ID of the current user is stored in the session yes
A user cannot vote for the same media more than once yes, but everyone gets Vote Successful when they attempt to vote
All media lists are ordered by vote count Yes
Splash page contains a media spotlight Yes
Wave 3 - Users and Votes
Media pages contain lists of voting users Yes
Individual user pages and the user list are present Yes
Optional - Styling
Bootstrap is used appropriately Yes
Look and feel is similar to the original Yes
Overall Great job overall! Your implementation matches the demo site very closely, and I would say the learning goals for this assignment were definitely met. There are a few places where things could be cleaned up, which I've tried to outline below, but in general I am quite happy with this submission. Keep up the hard work!

get 'sessions/login', to: 'sessions#new'
delete 'sessions/destroy', to: 'sessions#destroy', as: 'logout'

resources :works, :users

Choose a reason for hiding this comment

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

I don't think you need all 7 restful routes for users - only index and show are needed for this project.

</tr>
<tbody>
<% @movies.each do |movie| %>
<tr>

Choose a reason for hiding this comment

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

You have the same code to show a list of works repeated 3 times. Could you use a view partial or a loop to DRY this up?


def upvote(user)
#Vote.create(user: user, work: self)
votes.create(user: user)

Choose a reason for hiding this comment

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

Create will return a Vote regardless of whether it succeeds or fails, its up to you to interpret the data! This is why your upvotes don't add more votes to the total, but the error messaging is incorrect.

@@ -0,0 +1,6 @@
class Vote < ApplicationRecord
belongs_to :user
belongs_to :work

Choose a reason for hiding this comment

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

You can't delete a work that has votes! This is because you've created a link between the two tables at the database level, and deleting the work would leave behind invalid votes. You might want to check out the dependent argument to has_many.

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