Skip to content

Conversation

@sarabrandao21
Copy link

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 has the data of the app. It controls the database, name of columns, table name...
Describe in your own words what the Controller is doing in Rails The controller decides what to do with the requests it receive from the router. It will send back a response.
Describe in your own words what the View is doing in Rails the view is what is render on the browser.
Describe an edge-case controller test you wrote my test checks if will the method EDIT redirect when attempting to edit a nonexistent task. I used a negative id number on my edge-case test.
What is the purpose of using strong params? (i.e. the params method in the controller) to reduce code, makes it looks cleaner and adds layer of security.
How are Rails migrations related to Rails models? Rails migration is a tool for changing an application's database schema. Migrations provides a way to modify database schema within the Rails application
Describe one area of Rails that are still unclear on adding a button mark complete and incomplete made me a little confused.

@kaidamasaki
Copy link

kaidamasaki commented May 8, 2020

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 No styling.
Handles errors like nonexistant tasks ✔️
Uses form_with to render forms in Rails ✔️

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 ✔️
Successfully handles: Destroy, Task Complete ✔️

Overall Feedback

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

Copy link

@kaidamasaki kaidamasaki left a comment

Choose a reason for hiding this comment

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

Great job! Here are a couple of ways you can clean up your future projects.

Comment on lines +55 to +67
def complete
@task = Task.find_by(id: params[:id])
if @task.nil?
head :not_found
return
elsif @task.completed_at == ""
@task.update(completed_at: Time.now)
redirect_to tasks_path
return
else
@task.update(completed_at: "")
end
end

Choose a reason for hiding this comment

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

I'd generally recommend splitting actions like this into two parts in the future. One to mark complete and one to mark incomplete.

One reason is that things can get confusing if the user's computer or internet is slow. If the page takes a while to load and the user clicks the button several times you could get several requests that could potentially cancel each other out.

Where as if your endpoint doesn't toggle back and forth your task will just be marked complete several times.

create_table :tasks do |t|
t.string :name
t.string :description
t.string :complete_at

Choose a reason for hiding this comment

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

In the future you should use t.datetime for columns like these.

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