Skip to content

Commit fffd86f

Browse files
Update Wave 6 doc
1 parent 48fe593 commit fffd86f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ada-project-docs/wave_06.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22

33
## Goal
44

5-
Our users want to associate tasks and goals. Specifically, our users want to designate that there are many tasks that serve one goal.
5+
Our users want to associate `Task`s and `Goal`s. Specifically, our users want to designate that there are many tasks that serve one goal.
66

77
This wave focuses on creating a one-to-many relationship between goals and tasks, where a goal has-many tasks, and a task belongs to one goal.
88

99
When we have many tasks and many goals, users will want to conveniently gather all of the tasks associated with one goal. Our API should serve this information with a new route, `/goals/<goal_id>/tasks`.
1010

1111
## Requirements
1212

13-
First, we should update our models so that the relationship is saved in our database.
13+
First, we should update our models so that the relationship between them is created in our database.
1414

1515
Secondly, we should create our new route, `/goals/<goal_id>/tasks`, so that our API gives back the right information.
1616

17+
Use the tests in `tests/test_wave_06.py` to guide your implementation.
18+
- Some tests use a fixture named `one_task_belongs_to_one_goal` that is defined in `tests/conftest.py`.
19+
- This fixture uses other fixtures to save a task and a goal to the test database, then associates the task with the goal, and stores that updated relationship in the test database.
20+
1721
### Tips
1822

1923
- Use lesson materials and independent research to review how to set up a one-to-many relationship in Flask.
20-
- Remember to run `flask db migrate` and `flask db upgrade` whenever there is a change to the model.
24+
- Remember to run `flask db migrate` and `flask db upgrade` whenever there is a change to a model.
2125
- Pay attention to the exact shape of the expected JSON. Double-check nested data structures and the names of the keys for any misspellings.
22-
- Use the tests in `tests/test_wave_06.py` to guide your implementation.
23-
- Some tests use a fixture named `one_task_belongs_to_one_goal` that is defined in `tests/conftest.py`. This fixture saves a task and a goal to the test database, and uses SQLAlchemy to associate the goal and task together.
2426

2527
### Updates to the Goal Model
2628

@@ -37,8 +39,6 @@ After reviewing the strategy for creating a one-to-many relationship, in the Tas
3739
- Setting the foreign key to `goal`'s primary key column
3840
- Using `Optional` syntax to make the attribute nullable
3941

40-
Remember to run `flask db migrate` and `flask db upgrade` whenever there is a change to the model.
41-
4242
### Sending a List of Task IDs to a Goal
4343

4444
Given:
@@ -54,7 +54,7 @@ When I send a `POST` request to `/goals/1/tasks` with this request body:
5454
}
5555
```
5656

57-
Then the three `Task`s belong to the `Goal` and it gets updated in the database, and we get back a `200 OK` with the following response body:
57+
Then the three `Task`s belong to the `Goal` and it gets updated in the database. We get back a `200 OK` with the following response body:
5858

5959
```json
6060
{
@@ -102,7 +102,7 @@ then I get this response:
102102
}
103103
```
104104

105-
Notice that if we have been using a model helper method to return a dictionary representation of a Task, we can use this method to help build this route response. However, we must notice that there is an additional key in the data for the Task models that are associated with the Goal. This doesn't necessarily mean that we should abandon the model helper method, but we may need to introduce logic to allow it to work in this context.
105+
Notice that if we have been using a model helper method to return a dictionary representation of a Task, we can use this method to help build this route response.
106106

107107
This is also true of the Goal model helper method. We may need to introduce logic to allow it to work in this context, or use the existing method to generate the basic dictionary representation of the Goal and then add the additional data for the associated Task models.
108108

0 commit comments

Comments
 (0)