openstax/tutor — pull request #13 by jpslav (2014-10-07 17:31:16+00:00)
Title: Task API reorganization + reading task work for sprint 002

This PR includes the reorganization of the Task API (collapsing tasks and detailed tasks into one JSON object, moving the assignment information out of Task and into AssignedTask) as well as the work to create a Reading task and assign it to a User (for sprint 002).

There are no tests, for which I plead vacation :-)

To see the reading assigned to a user, do the following (which blows away your development database, fyi):

rake db:drop
rake db:migrate
rake sprint:002

The final command will create a user with a random username (which will be printed to the terminal), and that user will have one reading task. The reading task JSON can be seen by logging in as the user (click "Sign in!", search for users, there will be only one, click "Sign in as" on that row), then navigating to http://localhost:3001/api/user/tasks, which will look like:

```
{
total_count: 1,
items: [
{
id: 1,
type: "reading",
is_shared: false,
url: "http://cnx.org/contents/30189442-6998-4686-ac05-ed152b91b9de@17.23:21/Introductory_Statistics"
}
]
}
```

If you want a non-random username, the last rake command can be something like

rake 'sprint:002[jpslav]'

@Dantemss please review and merge when ready (or feel free to fix things if I'm not responding). I know there are missing things in models, etc. Was just trying to get the new approach set up quickly so Phil can connect with it ASAP in this sprint.

@philschatz heads up that this is coming -- of course feel free to try out this branch and comment on the PR.