Skip to content

Time - Yaz#53

Open
saintmedusa wants to merge 45 commits into
Ada-C13:masterfrom
saintmedusa:master
Open

Time - Yaz#53
saintmedusa wants to merge 45 commits into
Ada-C13:masterfrom
saintmedusa:master

Conversation

@saintmedusa

Copy link
Copy Markdown

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote. In works I made a method for creating a works hash organized by category. This is partly done by a field trackoing current catgories
Describe how you approached testing that model method. What edge cases did you come up with? I only tested nominal cases
What are session and flash? What is the difference between them? flash allows us to send info about the current or last request cycle back to browser, session tracks all recurrent tracked info about a user's session on the browser
What was one thing that you gained more clarity on through this assignment? I feel like I under stand http more
What is the Heroku URL of your deployed application? https://media-ranker-ada-yaz.herokuapp.com/

Assignment Submission: Media Ranker

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Prompt Response
What was a custom model method you wrote? What was it responsible for doing?
Describe how you approached testing that model method. What edge cases did you come up with?
What are session and flash? What is the difference between them?
What was one thing that you gained more clarity on through this assignment?
What is the Heroku URL of your deployed application?

…ilt in basic parameters in controller and validations in model.
…ation for work's categories by check against valid values. Also addded a retrieve category method for retrieving sub collections of works of certain categories. Written and passing corresponding tests.
…dia. Changed controller works#index to hash structure pointing to three seperate category arrays
…th corresponding routes in routes.rb. Also deleted extraneous user#actions
@CheezItMan

Copy link
Copy Markdown

Media Ranker

Functional Requirements: Manual Testing

Criteria yes/no
Before logging in --
1. On index page, there are at most 10 pieces of media on three lists, and a Media Spotlight ⚠ Spotlight is missing and the works are not sorted by the number of votes.
2. Can go into a work's show page ✔️
3. Verify unable to vote on a work, and get a flash message ✔️
4. Can edit this work successfully, and get a flash message ✔️
5. Can go to "View all media" page and see three lists of works, sorted by vote ⚠ Not sorted by votes
6. Verify unable to create a new work when the form is empty, and details about the validation errors are visible to the user through a flash message ⚠ You get a flash message, but not details about the validation errors.
7. Can create a new work successfully. Note the URL for this work's show page ✔️
8. Can delete this work successfully ✔️
9. Going back to the URL of this deleted work's show page produces a 404 or some redirect behavior (and does not try to produce a broken view) ✔️
10. Verify that the "View all users" page lists no users ✔️
Log in --
11. Logging in with a valid name changes the UI to "Logged in as" and "Logout" buttons ✔️
12. Your username is listed in "View all users" page ✔️
13. Verify that number of votes determines the Media Spotlight ⚠ No media Spotlight displayed
14. Voting on several different pieces of media affects the "Votes" tables shown in the work's show page and the user's show page ⚠ Nothing is sorted by votes
15. Voting on the same work twice produces an error and flash message, and there is no extra vote ✔️
Log out --
16. Logging out showed a flash message and changed the UI ✔️
17. Logging in as a new user creates a new user ✔️
18. Logging in as an already existing user has a specific flash message ✔️

Major Learning Goals/Code Review

Criteria yes/no
1. Sees the full development cycle including deployment, and the app is deployed to Heroku ⚠ The deployed app isn't working, I get an error message
2. Practices full-stack development and fulfilling story requirements: the styling, look, and feel of the app is similar to the original Media Ranker ✔️, not quite the same, but good'nuf
3. Practices git with at least 25 small commits and meaningful commit messages ✔️

Previous Rails learning, Building Complex Model Logic, DRYing up Rails Code

Criteria yes/no
4. Routes file uses resources for works ✔️
5. Routes file shows intention in limiting routes for voting, log-in functionality, and users ✔️
6. The homepage view, all media view, and new works view use semantic HTML ✔️
7. The homepage view, all media view, and new works view use partials when appropriate ✔️
8. The model for media (likely named work.rb) has_many votes ✔️
9. The model for media has methods to describe business logic, specifically for top ten and top media, possibly also for getting works by some category ✔️
10. Some controller, likely the ApplicationController, has a controller filter for finding a logged in user ✔️
11. Some controller, likely the WorksController, has a controller filter for finding a work ✔️
12. The WorksController uses strong params ✔️
13. The WorksController's code style is clean, and focused on working with requests, responses, params, session, flash ✔️

Testing Rails Apps

Criteria yes/no
14. There are valid fixtures files used for users, votes, and works ⚠ No fixtures defined
15. User model has tests with sections on validations (valid and invalid) and relationships (has votes) ⚠ it has validations tests, but not for relationships
16. Vote model has tests with sections on validations (valid and invalid) and relationships (belongs to a user, belongs to a vote) ⚠ No tests for vote model
17. Work model has tests with sections on validations (valid and invalid) and relationships (has votes) ⚠ it has tests for validations but not relationships.
18. Work model has tests with a section on all business logic methods in the model, including their edge cases ⚠ It has some business logic tests

Overall Feedback

Overall Feedback Criteria yes/no
Yellow (Approaches Standards) 12+ in Functional Requirements: Manual Testing && 11+ in Code Review, or the instructor judges that this project needs special attention You have a lot of the basic functionality here, but are missing a lot of tests, your routing needs work and you're not sorting works by the number of votes they receive.

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Concise

Summary

Thanks for getting this in. This shows a good amount of growth and some solid progress in many areas, such as controller filters, and model methods. You do have several areas for improvement:

  1. Testing, there are some tests, but not many and controller testing is nonexistant.
  2. Routing: Your upvoting method should probably be a nested route under works. You also have some unused routes.
  3. Working with models: You need to see if you can figure a way to sort works by the number of votes they have.

If you push any further commits and want me to review them, just ping me on Slack and I'll give it a 2nd look.

Comment on lines +4 to +7
it "must get create" do
get votes_create_url
must_respond_with :success
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just noting that you need to do testing on VotesController

You'll need to:

  1. Login
  2. Find a work
  3. Upvote that work with the work_votes_path

Then write tests verifying things happened right.

Comment thread config/routes.rb
@@ -0,0 +1,15 @@
Rails.application.routes.draw do
get 'votes/create'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This route would need:

  1. more information, the work to upvote
  2. To be a post request

I would suggest you make this a nested route under works.

Comment thread config/routes.rb
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root to: "works#top_10"
resources :works
get 'works/spotlight', to: 'works#spotlight', as: "spotlight"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you need a separate route for spotlight? That's part of the homepage.

Comment thread config/routes.rb
get "/current_user", to: "users#current", as: "current_user"
resources :users, only: [:index, :show]

post "/votes/create", to: "votes#create", as: "vote_create"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You seem to have this route duplicated.

@@ -0,0 +1,4 @@
<%= render partial: "single_work"%>
<%= button_to "Upvote", vote_create_path(@work) %>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you look at routes.rb you don't have a route parameter for the work id.

<th><%#votes%></th>
</tr>
<%end%>
<% @works[category].each do |work|%>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just noting this would be a great view helper.

@@ -0,0 +1,39 @@
require "test_helper"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just noting these test don't work and are the autogenerated tests.

Comment on lines +4 to +6
# it "does a thing" do
# value(1+1).must_equal 2
# end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just noting no tests for WorksController.

Comment on lines +2 to +3
skip_before_action :require_login
before_action :find_work, only: [:show, :edit, :update, :destroy]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice partials!

Comment thread app/models/work.rb
Comment on lines +14 to +19
def self.retrieve_category(work_category)
if !@categories.include? work_category
raise ArgumentError.new("not a valid category")
end
return Work.where(category: work_category).to_a
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just noting that these are not sorted by votes.

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