Open
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
reviewed
May 11, 2020
kaidamasaki
left a comment
There was a problem hiding this comment.
Great job! Just one suggestion on how to improve your future designs. 😃
Comment on lines
+68
to
+84
| 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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions