Skip to content

Conversation

@lillers1122
Copy link

@lillers1122 lillers1122 commented Apr 14, 2018

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. self.get_sorted_works(type) is a method I wrote for Work to return the first ten of a given type.
Describe how you approached testing that model method. What edge cases did you come up with? I need more robust tests...wrote 22, but they feel pretty standard.
What are session and flash? What is the difference between them? Session and flash both use a user's browser to hold information instead of sending requests back to a database.
Describe a controller filter you wrote. I wrote a controller filter to has a user stay logged in through a session. If I was going to refine my code I would use a different name than @user because having 2 @users (logged in and if displaying the show page of a different user) caused a headache.
What was one thing that you gained more clarity on through this assignment? What is going on with Rails.
What is the Heroku URL of your deployed application? https://lillers-media-ranker.herokuapp.com/
Do you have any recommendations on how we could improve this project for the next cohort? It was a great project! Super fun mostly, exhausting, definitely learned a lot. Session and Flash were particularly confusing though.

@tildeee
Copy link

tildeee commented Apr 20, 2018

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 x
Business logic lives in the models x
Models are thoroughly tested, including relations, validations and any custom logic missing some tests on custom logic (top_ten, categorized)
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 x
All media lists are ordered by vote count x
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

Great job! The site functions as expected and I think you hit all of the goals for this project. The code generally looks good.

There's a few unit tests that I would have liked to see and one place of refactoring that I'm commenting on. Also, your main page doesn't limit the listed "top ten" works to ten?

Otherwise I think it's good work!

<div class="top-bar-right">
<ul class="menu">
<% if session[:user_id] != nil %>
<li><%= link_to "Logged in as #{User.get_username(session[:user_id])}" , user_path(session[:user_id]), method: :get, class: "button"%></li>
Copy link

Choose a reason for hiding this comment

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

You reference session[:user_id] a lot in this section of code:

  • you use a conditional on it
  • you get the username here through {User.get_username(session[:user_id])}
  • you use it for the user_path param

You already declare before_action :find_user in each controller, so each view will have a value on @user... maybe you could use that value?


validates :publication_year, presence: true, numericality: {only_integer: true, greater_than: 0, less_than_or_equal_to: Date.current.year}

KINDS = ["Album", "Book", "Movie"]
Copy link

Choose a reason for hiding this comment

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

I like that you name the categories in this array as a constant!

You could push this further to make it an array of symbols

@@ -0,0 +1,18 @@
<%= form_for @work do |f| %>
<%= f.label :category %>
<%= f.select :category, ["Album", "Book", "Movie"] %>
Copy link

Choose a reason for hiding this comment

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

You hardcoded the list of categories here, but it might've been cool to find a rails form helper to populate a select with all unique categories that works have. ;) Just a thought.

<%= f.text_field :description %>

<%= f.submit class: "button"%>
<% end %>
Copy link

Choose a reason for hiding this comment

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

watch your indentation :)

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