Skip to content

Conversation

@Faiza1987
Copy link

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. sort_by_category -> It sorts the all the media by the category they belong to, stores them in an array and returns that array. The category is passed in as an argument to the method.
Describe how you approached testing that model method. What edge cases did you come up with? I tested that the method is returning an array. I then created a book and selected it at random from the array and tested that it was an instance of Work and that the category was correct.
What are session and flash? What is the difference between them? Session is a Rails hash and tracks a users 'session' when they are logged in. Rails automatically deletes the user's data from the session when they log out or close their browser. Flash is a Rails hash that is used to send messages from the controller and display them in the view. They can be success or error messages.
What was one thing that you gained more clarity on through this assignment? The ordering of Rails routes and deploying to heroku.
What is the Heroku URL of your deployed application? https://media-ranker-app.herokuapp.com/
Do you have any recommendations on how we could improve this project for the next cohort? This was a tough project and a good learning experience.

…s to cofirm database seeded correctly from csv file
Fixed view for works/index to show correct number or works for each c…
@tildeee
Copy link

tildeee commented May 7, 2019

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
Views are well-organized (DRY, use of semantic HTML, use of partials) well done
Errors are reported to the user missing messages on works validations and invalid login, otherwise well done
Business logic lives in the models x
Models are thoroughly tested, including relations, validations and any custom logic x
Controllers are thoroughly tested, including the login/logout process and multi-step workflows like voting for a work x
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
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
Wave 3 - Users and Votes
Media pages contain lists of voting users x
Individual user pages and the user list are present x, missing current user view (exists but empty)
Optional - Styling
Bootstrap is used appropriately x
Look and feel is similar to the original x
Overall

Great work with this project, Faiza! Your code on this project looks fantastic, and definitely hits and demonstrates accomplishing the learning goals.

Besides the small details I mentioned above (some missing flash messages/form error messages on certain things, a missing view), my other comments are on more small code style suggestions. They're minor and mostly there to help you think about refactoring.

That being said; well done! This was a huge project with a lot of moving parts. ALSO your controller tests were great! I have no comments on how to improve them at the moment! :)

if work.category == category
works_sorted_by_category << work
end
end
Copy link

Choose a reason for hiding this comment

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

Nice iteration! :)

if work.category == category
works_sorted_by_category << work
end
end
Copy link

Choose a reason for hiding this comment

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

Consider this refactor: using works_sorted_by_category = Work.where(category: category)

  def self.sort_by_category(category)
    works_sorted_by_category = []
    works_sorted_by_category = Work.where(category: category)
    return works_sorted_by_category
  end

You'd have to update your test to not expect this to be an Array though

return works_sorted_by_category
end

def self.popular(category: nil)
Copy link

Choose a reason for hiding this comment

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

This is a super clever helper method! You pulled out repeated logic. Well done!

end

def self.media_spotlight
return popular.first
Copy link

Choose a reason for hiding this comment

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

Just a note for consistency (not a big deal): Above in self.popular, you invoke the other class methods with Work.sort_by_category, but here you invoke the class method with just popular. It may make more sense to be consistent: Work.sort_by_category and Work.popular, or sort_by_category and popular (PS: In your tests you consistently do Work.popular etc)

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