-
Notifications
You must be signed in to change notification settings - Fork 47
Time - Vera #31
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
base: master
Are you sure you want to change the base?
Time - Vera #31
Conversation
Students think that they should create an action that toggles. I think we should change this to describe "mark_complete" do.
change "toggle_complete"
Task ListMajor Learning Goals/Code Review
Functional Requirements/Manual Testing
Overall Feedback
Code Style Bonus AwardsWas the code particularly impressive in code style for any of these reasons (or more...?)
|
kaidamasaki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Just one suggestion on how to improve your future designs. 😃
| def completed_at | ||
| task_id = params[:id] | ||
| task = Task.find_by(id: task_id) | ||
|
|
||
| if task.nil? | ||
| head :not_found | ||
| return | ||
| elsif task.completed_at | ||
| task.completed_at = nil | ||
| else | ||
| time = Time.now | ||
| task.completed_at = time.strftime("%d of %B, %Y") | ||
| end | ||
|
|
||
| task.save | ||
| redirect_to tasks_path | ||
| end |
There was a problem hiding this comment.
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.
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions