Skip to content

Conversation

@gracemshea
Copy link

@gracemshea gracemshea commented Apr 29, 2019

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. I have a model that returns the works with the top 10 by votes by category.
Describe how you approached testing that model method. What edge cases did you come up with? When testing in general I generated 10 works and test for them to be present. For edges, I tested that it would return the entire list of work if there were less than 10 or an empty array for no works.
What are session and flash? What is the difference between them? Session and flash are hash-like objects that persist through request-response cycle. Session lasts until the user exits the browser (or logs out which essentially sets the user of the session to nil). Flash persists over one cycle and is cleared after the next action.
What was one thing that you gained more clarity on through this assignment? Validations, Relationships, and Custom Methods in models and model testing.
What is the Heroku URL of your deployed application? https://grace-media-ranker-app.herokuapp.com/
Do you have any recommendations on how we could improve this project for the next cohort? I felt really disorganized on this project. I think it was related to learning things in class and feeling like I was starting aspects of my project over to try and apply that knowledge. A mid-week check in might have been nice, although I'm not sure if others were quite as scattered/challenged as me.

@gracemshea gracemshea marked this pull request as ready for review April 29, 2019 14:44
@droberts-sea
Copy link

Media Ranker

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene
Comprehension questions
General
Rails fundamentals (RESTful routing, use of named paths) yes
Views are well-organized (DRY, use of semantic HTML, use of partials) yes - good work!
Errors are reported to the user yes
Business logic lives in the models yes
Models are thoroughly tested, including relations, validations and any custom logic yes
Controllers are thoroughly tested, including the login/logout process and multi-step workflows like voting for a work yes - great work!
Wave 1 - Media
Splash page shows the three media categories Almost - you have a bug in your Work.get_media_categories method
Basic CRUD operations on media are present and functional yes
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
All media lists are ordered by vote count no
Splash page contains a media spotlight yes, but see inline
Wave 3 - Users and Votes
Media pages contain lists of voting users yes, but see inline
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

This is a strong submission. Your implementation matches the demo site very closely, and I would say the learning goals for this assignment were definitely met.

However, there are a number of bugs in this app that were small and straightforward to fix, but which had a devastating effect on the user experience, like not showing any works on the splash or index pages, not displaying the login form, or not being able to upvote or delete from the show page.

What that tells me is that you're relying exclusively on your tests to tell you whether your site works. Your testing on this assignment is really strong, but there were a couple of places where it didn't quite match up with what the user is doing. These are all things that manually running through the workflows of your site would have caught immediately.

The takeaway is, before you submit your next assignment, spend 10 minutes running through it manually and making sure it works!

<% form_with model: @user, url: login_path do |f| %>
<div class="form-group">
<%= f.label :name %>
<%= f.text_field :name, placeholder: "Username", class:"form-control" %>

Choose a reason for hiding this comment

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

Line 3 should be a value tag (<%=), otherwise the form won't appear on the page.

def self.get_media_categories
books = self.get_media("books")
albums = self.get_media("albums")
movies = self.get_media("movies")

Choose a reason for hiding this comment

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

Here you search for works with category albums, books and movies, but your database seeds and the dropdown menu on your new work form use the singular version of these (album, book, movie). As a result, your index and splash pages don't display any works.

<%= link_to "Edit", edit_work_path(@work.id), class: "btn btn-primary btn-lg" %>
<%= link_to "Upvote", class: "btn btn-primary btn-lg" %>
<%= link_to "Delete", class: "btn btn-danger btn-lg" %>
</section>

Choose a reason for hiding this comment

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

The links on line 13 and 14 are missing URLs, so neither of them works.

<section class="spotlight">
<% media = Work.all.sample%>
<h2 class="spotlight__header">
<span class="spotlight__header--prefix"> Media Spotlight </span>

Choose a reason for hiding this comment

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

This should probably use the @spotlight variable that you set up in the controller. As-is it shows a random work, not the one with the most votes.

<section class="top-ten__list-container">
<h2>Top Movies</h2>
<%= render "top_ten", top: @top_ten[2] %>
</section>

Choose a reason for hiding this comment

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

I love the way you've used a partial to DRY this up - it makes this code much more readable.

get "/", to: "homepages#index"
resources :works, only: [:index, :show, :new, :create, :edit, :update, :destroy]
resources :works do
resources :votes, only: [:create]

Choose a reason for hiding this comment

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

This code is a little redundant:

  • On line 6, you limit resources to generate "only" all 7 of the RESTful routes
  • On line 7, you re-generate all 7 routes again

The change here would be to omit line 6.

post "/login", to: "users#login"
get "/users/current", to: "users#current", as: "current_user"

resources :users, only: [:index, :show]

Choose a reason for hiding this comment

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

Good work generating only the routes your application needs.

class Vote < ApplicationRecord
belongs_to :user
belongs_to :work
validates :user, uniqueness: { scope: [:work], message: "has already voted for this work" }

Choose a reason for hiding this comment

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

Good work getting this tricky uniqueness scope figured out!

def self.top_media
top_works = get_media_categories.map do |category|
category[0..9]
end

Choose a reason for hiding this comment

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

I love the way the methods in this file build on each other, each providing a small bit of functionality. This is an excellent example of functional decomposition.


it "will create an account for and login a new user" do
@login_data[:user][:name] = "new user"

Choose a reason for hiding this comment

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

Good work catching the two different success cases here.

Is there a failure case? What if the user forgets to type in their name before logging in?

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