Skip to content

Conversation

@MiraMarshall
Copy link

@MiraMarshall MiraMarshall commented Apr 16, 2019

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 contains data for the app usually linked to a database. It contains business logic.
Describe in your own words what the Controller is doing in Rails The Controller is the central manager of the Rails App. It gathers data from the model and passes the data to the view to be rendered as HTML.
Describe in your own words what the View is doing in Rails The View turns data into HTML. It only displays the business logic and is similar to command line interfaces.
Describe an edge-case controller test you wrote An example of edge cases I wrote were tests to check redirection for invalid input.
What is the purpose of using strong params? (i.e. the params method in the controller) Strong params is a security measure to help prevent users from accessing model attributes.
How are Rails migrations related to Rails models? The migrations create the schema(data table) that the models use to contain the state of the application.
Describe one area of Rails that are still unclear on I'm interested in learning more about the Model and business logic. Instructors mentioned how we could use caching could store data. I would like to see how using something like that could make the App more interactive and mirror predictive behavior based on user actions.

@CheezItMan
Copy link

Task List

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with no extraneous files checked in You should have more commits, but you have good commit messages and no unnecessary files committed.
Answered comprehension questions Check, well you'll get business logic in the project this week!
Successfully handles: Index, Show Check
Index & Show tests pass Check
Successfully handles: New, Create Check
New & Create tests pass Check
Successfully handles: Edit, Update Check
Tests for Edit & Update test valid & invalid task ids Check
Successfully handles: Destroy, Task Complete Task complete isn't working, I left notes as to why
Tests for Destroy & Task Complete include tests for valid and invalid task ids Your tests look good.
Routes follow RESTful conventions Check
Uses named routes (like _path) Check, well done
Overall Nice work, you hit most of the learning goals for the project. See my notes on your mark complete route.


def create
task = Task.new(task_params)
if task.name == "" || task.description == "" || task.completion_date == ""

Choose a reason for hiding this comment

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

This is a little weird. .save is a method, you shouldn't assign it a value.

It also crashes rails

if is_successful
redirect_to task_path(task.id)
else
head :temporary_redirect

Choose a reason for hiding this comment

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

Why temporary redirect? why not server error or something?

<%= f.label :completion_date %>
<%= f.text_field :completion_date%>

<%= f.submit action_name, class:"task-form_submit-btn"%>

Choose a reason for hiding this comment

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

👍

<%= link_to task.name, task_path(task.id)%>
Details: <%= task.description%>, due <%= task.completion_date%> <%= link_to "Mark Complete", toggle_path(task.id), method: :patch, data: { confirm: "Mark Complete?" } %>
</li>
<li><%= link_to "Delete", task_path(task.id), method: :delete, data: { confirm: "Are you sure you want to delete?" } %></li>

Choose a reason for hiding this comment

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

Nice confirmation

def toggle
@complete_task = Task.find_by(id: params[:id])
# is_complete = complete_task.update(status )
if @complete_task.update(:status => false)

Choose a reason for hiding this comment

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

This if statement is checking to see if the update method works or not, it doesn't check to see what complete_task.status is.

Instead I would do:

@complete_task = Task.find_by(id: params[:id])

if @complete_task
  @complete_task.status = ! @complete_task.status
  if @complete_task.save 
    redirect_to tasks_path
  else
     head :server_error
  end
else
  head :not_found
end

patch toggle_path(complete_task.id)
toggle = Task.find_by(id: complete_task.id)
# Assert
expect(toggle.status).must_equal true

Choose a reason for hiding this comment

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

This test is failing... Also you need to test that once you toggle a task to complete, you can toggle it incomplete.

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