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

Water - Sophia #50

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

Water - Sophia #50

wants to merge 32 commits into from

Conversation

SoCodeDo
Copy link

Media Ranker

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe a custom model method you wrote.
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?

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?

…with basic HTML & made navigation, header, footer
@SoCodeDo
Copy link
Author

I'm sorry this is late & incomplete :(
I started late on this project and am still working on Wave 1 as of Monday morning. Turning in to focus on bEtsy but will return/finish later.

@jmaddox19
Copy link

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 ✔️
2. Can go into a work's show page ✔️
3. Verify unable to vote on a work, and get a flash message No vote button present
4. Can edit this work successfully, and get a flash message No flash message
5. Can go to "View all media" page and see three lists of works, sorted by vote Not sorted by votes because voting is not supported
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 As a user, I don't see any 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
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
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
2. Practices full-stack development and fulfilling story requirements: the styling, look, and feel of the app is similar to the original Media Ranker ✔️
3. Practices git with at least 25 small commits and meaningful commit messages I count 19, but the number of commits feels right with the amount that you completed

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 ✔️ Yes? But only be cause there is not voting or login functionality.
6. The homepage view, all media view, and new works view use semantic HTML ✔️ I like the sections and tables you setup!
7. The homepage view, all media view, and new works view use partials when appropriate No partial shared by homepage and all media views but there is one for the work form
8. The model for media (likely named work.rb) has_many votes The code is there but it doesn't work since there's no Vote model
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 ✔️ Works only, as the rest hasn't been implemented
15. User model has tests with sections on validations (valid and invalid) and relationships (has votes)
16. Vote model has tests with sections on validations (valid and invalid) and relationships (belongs to a user, belongs to a vote)
17. Work model has tests with sections on validations (valid and invalid) and relationships (has votes) None for relationships, as votes isn't supported
18. Work model has tests with a section on all business logic methods in the model, including their edge cases No custom method models

Overall Feedback

Everything that you completed looks good! And you did an impressive job matching the styling!

The way that the server wasn't working without me fixing something makes me wonder if you were running the server to test out your work as you were doing it. I highly, highly encourage running the server and testing the website out for yourself regularly as you're working on Rails work!

There are some pieces missing around login and voting and cover the primarily learning objectives for the week.

Again, everything that's here is good!

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 14+ in Functional Requirements: Manual Testing && 14+ in Code Review
Yellow (Approaches Standards) 12+ in Functional Requirements: Manual Testing && 11+ in Code Review, or the instructor judges that this project needs special attention
Red (Not at Standard) 0-10 in Code Review or 0-11 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging, or the instructor judges that this project needs special attention ✔️

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
Logical/Organized

config/routes.rb Outdated
delete '/works/:id', to: 'works#delete', as: 'delete_work'
patch '/works/:id/complete', to: 'works#complete', as: 'complete_work'

root to: 'homepage#index'

Choose a reason for hiding this comment

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

When I test out the server, I get the error uninitialized constant HomepageController.

Suggested change
root to: 'homepage#index'
root to: 'homepages#index'


<div clss="form_group">
<%= f.label :title %>
<%= f.text_area :title, class: "form-control" %>

Choose a reason for hiding this comment

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

These fields would all be more appropriate as text_field. text_area creates a large box and is appropriate to be used when you're expecting the user to implement a full sentence or paragraph that takes up multiple lines.
Not a huge deal but just looks kind of awkward on the page.

config/routes.rb Outdated
Comment on lines 3 to 19
get '/homepages', to: 'homepages#index'
get '/works', to: 'works#index', as: 'works'
get 'works/new', to: 'works#new', as: 'new_work'
post '/works', to: 'works#create'
get '/users', to: 'users#index', as: 'users'
get 'users/new', to: 'users#new', as: 'new_user'
post '/users', to: 'users#create'

# Routes for using a specific task page
get '/works/:id', to: 'works#show', as: 'work'
get '/works/:id/edit', to: 'works#edit', as: 'edit_work'
patch '/works/:id', to: 'works#update'
get '/works/:id/confirm_delete', to: 'works#confirm', as: 'confirm_work'
delete '/works/:id', to: 'works#delete', as: 'delete_work'
patch '/works/:id/complete', to: 'works#complete', as: 'complete_work'

root to: 'homepage#index'

Choose a reason for hiding this comment

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

I'm curious why you didn't user resources here at all. I hope you're able to practice that and get more comfortable with it in bEtsy

@jmaddox19
Copy link

Media Ranker (Round 2)

Great work! I'm really glad to see you were able to get login and voting working! Overall the app operated cohesively now. I get the impression you had more of a habit of running the server and manually testing your changes this time :D

There is still a notable gap in testing here but the core learning objectives around login and voting functionality are certainly met :)

I would encourage you to talk with me or someone else about the struggle you seemed to have with the work validation tests. I get the impression a brief conversation could probably help clear up the purpose of validation tests and how to write them.

But again, so glad to see the core features you were able to add in a pretty short amount of extra time 👏

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 ✔️
2. Can go into a work's show page ✔️
3. Verify unable to vote on a work, and get a flash message ✔️ Love the flash message and the redirect to the login page!
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 They aren't sorted by vote. The order seems to remain the same regardless of 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 No flash messages present
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 No "Logged in as" button
12. Your username is listed in "View all users" page ✔️
13. Verify that number of votes determines the Media Spotlight ✔️
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 There's no votes table on the work show page and the user show page doesn't exist
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 ✔️ I like the subtle "Welcome back" :D

Major Learning Goals/Code Review

Criteria yes/no
1. Sees the full development cycle including deployment, and the app is deployed to Heroku No but not required
2. Practices full-stack development and fulfilling story requirements: the styling, look, and feel of the app is similar to the original Media Ranker ✔️
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 Still no use of resources
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 There are a couple missed opportunities to practice working with partial views. See inline comments for details.
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 ✔️ Code looks great!

Testing Rails Apps

Criteria yes/no
14. There are valid fixtures files used for users, votes, and works For users but not for votes or works
15. User model has tests with sections on validations (valid and invalid) and relationships (has votes)
16. Vote model has tests with sections on validations (valid and invalid) and relationships (belongs to a user, belongs to a vote)
17. Work model has tests with sections on validations (valid and invalid) and relationships (has votes) There are tests here but it looks like they cause some confusion and headache and they don't look quite right. I think it'd be good to checkin with me or someone else about that.
18. Work model has tests with a section on all business logic methods in the model, including their edge cases

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 14+ in Functional Requirements: Manual Testing && 14+ in Code Review
Yellow (Approaches Standards) 12+ in Functional Requirements: Manual Testing && 11+ in Code Review, or the instructor judges that this project needs special attention ✔️
Red (Not at Standard) 0-10 in Code Review or 0-11 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging, or the instructor judges that this project needs special attention

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
Logical/Organized

Comment on lines +15 to +32
<hr class="root__hr">
<section class=top-ten__container">
<section class="top-ten__list-container">
<h2 class="top-ten__header">
Top Albums
</h2>
<ul class="list-group top-ten__list">
<% @albums.each do |work| %>
<li class="list-item">
<h4>
<%= link_to work.title, work_path(work.id) %>
<small class="top-ten-creator">by <%= work.creator %></small>
</h4>
<p><%= work.votes.count %></p>
</li>
<% end %>
</ul>
</section>

Choose a reason for hiding this comment

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

These top ten container sections would be a great candidate for a partial view that took a couple arguments because they're all three almost exactly the same. Sorry I wasn't very clear about explaining that in my previous feedback.

Comment on lines +4 to +24
<section class="media-table">
<h4>ALBUMS</h4>
<table class="table">
<tr>
<th>Votes</th>
<th>Title</th>
<th>Created By</th>
<th>Published</th>
<th>Upvote</th>
</tr>
<% @albums.each do |work| %>
<tr>
<td><%= work.votes.count %></td>
<td><%= link_to work.title, work_path(work.id) %></td>
<td><%= work.creator %></td>
<td><%= work.publication_year %></td>
<td><%= link_to "VOTE", work_path(work.id), class: "btn btn-primary"%></td>
</tr>
<% end %>
</table>
</section>

Choose a reason for hiding this comment

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

These media-table sections would be a great candidate for a partial view that took a couple arguments because they're all three almost exactly the same. Sorry I wasn't very clear about explaining that in my previous feedback.

Comment on lines +31 to +37
# change these below back to FALSE later on, for now change true so tests are passing.
# You've wasted enough time trying to debug this

it "must have a creator" do
@work.creator = nil
expect(@work.valid?).must_equal true
end

Choose a reason for hiding this comment

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

It looks like you ended up fixing the validation for creator so that this test now fails and line 36 here can be changed back to false

Suggested change
# change these below back to FALSE later on, for now change true so tests are passing.
# You've wasted enough time trying to debug this
it "must have a creator" do
@work.creator = nil
expect(@work.valid?).must_equal true
end
# change these below back to FALSE later on, for now change true so tests are passing.
# You've wasted enough time trying to debug this
it "must have a creator" do
@work.creator = nil
expect(@work.valid?).must_equal false
end

Comment on lines +39 to +47
it "must have a publication year" do
@work.publication_year = nil
expect(@work.valid?).must_equal true
end

it "must have a description" do
@work.description = nil
expect(@work.valid?).must_equal true
end

Choose a reason for hiding this comment

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

These weren't passing when you asserted they were false because there are no validations for these fields in work.rb. It's not always necessary to have validations for every field. When a field has no validations, no validation tests are needed for them.

Suggested change
it "must have a publication year" do
@work.publication_year = nil
expect(@work.valid?).must_equal true
end
it "must have a description" do
@work.description = nil
expect(@work.valid?).must_equal true
end

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