-
Notifications
You must be signed in to change notification settings - Fork 49
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
Ports - Jillianne #36
base: master
Are you sure you want to change the base?
Conversation
Task ListWhat We're Looking For
Jillianne! Great work with this project! Your code meets all of the requirements I was looking for: Rails best practices, RESTful routing, and CRUD. Particularly, I loooove how well-written your controller tests are! I only have a few notes for improvement. Otherwise, I think this is a great project submission. Also, I want to note that your Well done! |
class TasksController < ApplicationController | ||
# TASKS = [ | ||
# {name: "Call Ma", description: "Family First", completed_at: "", completion_date: ""} | ||
# ] |
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.
Don't forget to delete unused variables!
# ] | ||
|
||
def index | ||
@tasks = Task.all.order(:created_at) |
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.
Nice detail on ordering these
def toggle_complete | ||
task = Task.find_by(id: params[:id]) | ||
|
||
if task.completed_at == "Incomplete" |
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.
Instead of assuming that .completed_at
will be a string of either "Incomplete"
or "Complete"
, is there a better data type for this?
I think a boolean would be much better, and would prevent bugs. This way you don't need to do if ... elsif ... else
, but just if ... else
def toggle_complete | ||
task = Task.find_by(id: params[:id]) | ||
|
||
if task.completed_at == "Incomplete" |
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.
Is completed_at
the best name for this attribute if it is describing the state of the task's completion?
@@ -0,0 +1,37 @@ | |||
<link href="stylesheets/index.css" rel="stylesheet" type="text/css"> |
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.
You shouldn't need to do have this line in order to load your CSS. Rails should know how to load its own CSS
<% @tasks.each do |task| %> | ||
<br> | ||
<td><%= task.name %></td> | ||
<% if task.completed_at.nil? %> |
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.
You'll probably want to indent the code that's within the if
(and also the else
)
<br> | ||
<td><%= task.name %></td> | ||
<% if task.completed_at.nil? %> | ||
<br> |
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.
Better to not use br
tags as they're not semantic
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions