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

Amanda Ungco-MediaRanker #29

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

Conversation

amandaungco
Copy link

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. I wrote two costum class methods to sort the works by category and top vote.
Describe how you approached testing that model method. What edge cases did you come up with? I tested the model method by using the website due to limited time. Some edge cases I would've tested would be what happens when there is a tie in the number of votes in a given category.
What are session and flash? What is the difference between them? Flash sends one time messages from the controller to the view. A session is used to keep track of data while a user has the given browser window open. The data is automatically deleted when the window is closed.
Describe a controller filter you wrote. I created a controller filter for my entire website that sets the user_id of the session to the current user. This allows the website to know when someone is logged in or not and provides the information needed for the different actions to behave accordingly.
What was one thing that you gained more clarity on through this assignment? How to use inspect/write class methods.
What is the Heroku URL of your deployed application? https://aungco-media-ranker.herokuapp.com
Do you have any recommendations on how we could improve this project for the next cohort? Since the css styling is optional, it would be nice if the CSS was provided and then students just had to match the HTML to it. I spent a lot of time copy and pasting from the Heroku inspector that I should've spent on writing tests but felt pressured to have the site match the example.

@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, "costum" class methods? :p Sorry you found styling to be a big hassle.
General
Rails fundamentals (RESTful routing, use of named paths) Overall good, but you have some unused routes for UsersController.
Views are well-organized (DRY, use of semantic HTML, use of partials) You could definitely use more partials to avoid having to repeat view code for some of the tables.
Errors are reported to the user For the most part, the edit-update options for work do not deliver flash notices.
Business logic lives in the models Some logic in the models, the upvoting is all done in the controller which isn't a big issue, but it could also be done in the model.
Models are thoroughly tested, including relations, validations and any custom logic There's some good stuff here, but it looks like you ran out of time. See my inline notes.
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 For the most part yes
Look and feel is similar to the original Pretty close, nice work
Overall Overall, nice job, it does look like you put testing off till the end and didn't get finished, but you handled all the functionality and most of your tests are pretty good. See my inline comments and let me know any questions you have.

Rails.application.routes.draw do

root 'works#main'
resources :users

Choose a reason for hiding this comment

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

Do you need the full CRUD routes for users? You're not using :edit or :destroy for example.

@@ -0,0 +1,5 @@
class User < ApplicationRecord
has_many :works

Choose a reason for hiding this comment

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

No validations? Username can be blank? What about requiring unique usernames?

This isn't essential, but something to think about.

belongs_to :user
belongs_to :work

validates :user_id, presence: true, uniqueness: { scope: :work, message: "You can only add one vote per work"}

Choose a reason for hiding this comment

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

Since a vote belongs to a user by default user_id is required. The uniqueness of combining user_id and work_id is good. The custom message is great!

has_many :votes, dependent: :destroy
# has_many :users, through :votes

validates :title, presence: true, uniqueness: {scope: :category}

Choose a reason for hiding this comment

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

I like the uniqueness using the scope category here.

validates :publication_year, numericality: true, length: {is: 4}
validates :creator, presence: true

def self.sort_by_category(category)

Choose a reason for hiding this comment

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

The name sort_by_category doesn't sound right since this method doesn't really do sorting. Instead it does filtering.

end

it 'can only be voted on by a unique user once' do
# first_vote = Vote.first

Choose a reason for hiding this comment

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

I would suggest here, creating a new vote which is identical to one from your fixtures.

it 'must have a publication_year with a 4 integers' do
work.publication_year = 0
# Arrange
work.publication_year += 999

Choose a reason for hiding this comment

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

Why add 999 here?

expect(poodr.errors.messages).must_include :title
end
end

Choose a reason for hiding this comment

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

No test for category being present?

# below each fixture, per the syntax in the comments below
#
one:
user_id: 1

Choose a reason for hiding this comment

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

You should use the nicknames of existing fixtures in users.yml and works.yml

category: movie
description: magical movie


Choose a reason for hiding this comment

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

👍

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