Skip to content

Fire - Noor#47

Open
hn4ever wants to merge 10 commits intoAda-C14:masterfrom
hn4ever:master
Open

Fire - Noor#47
hn4ever wants to merge 10 commits intoAda-C14:masterfrom
hn4ever:master

Conversation

@hn4ever
Copy link

@hn4ever hn4ever commented Nov 3, 2020

Task List

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe in your own words what the Model is doing in Rails The model is where all the databases of the rail app are located.
Describe in your own words what the Controller is doing in Rails The controller receives events like HTTP requests, gather data from model, and pass the data to be viewed as HTML.
Describe in your own words what the View is doing in Rails The view is the resulted HTML page that has display logic.
Describe an edge-case controller test you wrote The "Toggle complete" test was an edge case, I tried to mark a task as complete, then marked as incomplete and later I made a test to check if the value of "completion_at" is nil
What is the purpose of using strong params? (i.e. the params method in the controller) It's used inside a controller in order to safely acquire data from forms.
How are Rails migrations related to Rails models? Model is where the database is and with migration we can have more control of the database in rails and it will also be useful for testing.
Describe one area of Rails that are still unclear on I'm still confused with how the routes should be organized and about HTTP verbs.

Copy link

@tildeee tildeee left a comment

Choose a reason for hiding this comment

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

Task List

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
At least 6 commits with meaningful commit messages ✔️
Routes follow RESTful conventions ✔️
Uses named routes (like _path) ✔️
Creates Models and migrations ✔️
Creates styled views ✔️
Handles errors like nonexistant tasks ✔️
Uses form_with to render forms in Rails You ended up using form_for instead, which is valid and works, but for this project we were expecting form_with

Functional Requirements/Manual Testing

Functional Requirement yes/no
Successfully handles index & show ✔️
index & show tests pass ✔️
Successfully handles: New, Create ✔️
New, Create tests pass ✔️
Successfully handles: Edit, Update ✔️
Edit, Update tests pass with valid & invalid task ids ✔️
Successfully handles: Destroy, Task Complete ✔️
Tests for Destroy & Task Complete include tests for valid and invalid task ids No test for Task Complete with invalid task id

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 5+ in Code Review && 6+ in Functional Requirements ✔️
Yellow (Approaches Standards) 3+ in Code Review && 5+ in Functional Requirements, or the instructor judges that this project needs special attention
Red (Not at Standard) 0-2 in Code Review or 0-4 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

Additional Feedback

Great work on this project, Noor! Your project has all the functionality I was looking for.

Your tests also look very good! I like how they're written. And I like the styling you put on your site :) !!!

There are a couple of things I'm commenting on your code-- nothing to do except think about them and let me know if you have any questions.

Also, something you should note: When creating a task, it already says that it is complete. I wouldn't expect that functionality, so it'd be interesting to figure out why it's happening!

Overall, great work!

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 +108 to +116
let (:new_task_hash) {
{
task: {
name: "Buy a Book",
description: "Buy a book about six sigma",
completed_at: "today"
},
}
}
Copy link

Choose a reason for hiding this comment

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

Great work leveraging the let syntax!

Comment on lines +133 to +134
get update_task_path(-1)
must_redirect_to root_path
Copy link

Choose a reason for hiding this comment

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

Well-written and concise test :)

Comment on lines +155 to +170
it "can toggle" do
task = Task.create(
name: "Buy Flowers",
description: "Buy flowers that has different colors",
completed_at: "today"
)

patch uncomplete_task_path(task.id)
task = Task.find_by(id: task.id)
expect(task.completed_at).must_be_nil

patch complete_task_path(task.id)
task = Task.find_by(id: task.id)
expect(task.completed_at).wont_be_nil

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!

Comment on lines +21 to +25
@task = Task.new(
name: params[:task][:name],
description: params[:task][:description],
completed_at: params[:task][:completed_at]
)
Copy link

Choose a reason for hiding this comment

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

It wasn't a requirement for this project, but if you had more time on this project, I'd encourage you to use a strong params method!

Comment on lines +78 to +80
def count
count = Task.count
end
Copy link

Choose a reason for hiding this comment

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

Does this method get used? If I comment this method out, all of your tests still pass.

If this method doesn't get used, then it's better to delete it!

Comment on lines +162 to +168
patch uncomplete_task_path(task.id)
task = Task.find_by(id: task.id)
expect(task.completed_at).must_be_nil

patch complete_task_path(task.id)
task = Task.find_by(id: task.id)
expect(task.completed_at).wont_be_nil
Copy link

Choose a reason for hiding this comment

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

I love this test! I think it's pretty awesome that you did multiple "act"s and multiple "assert"s. Usually I'd like to discourage that, but in this case, the asserts are very related, so it reads very well. :)

@hn4ever
Copy link
Author

hn4ever commented Nov 11, 2020

Thank you Simon

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