Estimated vs Tracked Time Report

With this test, we'll explain how you can quickly get Estimated vs Tracked time report using ActiveCollab's assignments filter. First, lets create a task:

Response: HTTP 200, application/json (Hide)
POST /projects/1/tasks

Payload:

1
2
3
4
5
{
    "name": "Task with an estimate",
    "job_type_id": 1,
    "estimate": 8
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
    "single": {
        "id": 1,
        "class": "Task",
        "url_path": "\/projects\/1\/tasks\/1",
        "name": "Task with an estimate",
        "assignee_id": 0,
        "delegated_by_id": 0,
        "completed_on": null,
        "completed_by_id": null,
        "is_completed": false,
        "comments_count": 0,
        "attachments": [],
        "labels": [],
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "project_id": 1,
        "is_hidden_from_clients": false,
        "body": "",
        "body_formatted": "",
        "created_on": 1430165042,
        "created_by_id": 1,
        "updated_on": 1430165042,
        "updated_by_id": 1,
        "task_number": 1,
        "task_list_id": 0,
        "position": 1,
        "is_important": false,
        "due_on": null,
        "estimate": 8,
        "job_type_id": 1,
        "total_subtasks": 0,
        "completed_subtasks": 0,
        "open_subtasks": 0
    },
    "subscribers": [
        1
    ],
    "comments": [],
    "reminders": [],
    "subtasks": [],
    "task_list": null,
    "tracked_time": 0,
    "tracked_expenses": 0
}

and then lets track some time (one record on project level, which should be included in our report, and two records on the task level):

Response: HTTP 200, application/json (Hide)
POST /projects/1/time-records

Payload:

1
2
3
4
5
6
{
    "value": "2:30",
    "user_id": 1,
    "job_type_id": 1,
    "record_date": "2015-04-27"
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
    "single": {
        "id": 1,
        "class": "TimeRecord",
        "url_path": "\/projects\/1\/time-records\/1",
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "billable_status": 1,
        "value": 2.5,
        "record_date": 1430092800,
        "summary": null,
        "user_id": 1,
        "parent_type": "Project",
        "parent_id": 1,
        "created_on": 1430165042,
        "created_by_id": 1,
        "updated_on": 1430165042,
        "updated_by_id": 1,
        "job_type_id": 1
    }
}
Response: HTTP 200, application/json (Hide)
POST /projects/1/time-records

Payload:

1
2
3
4
5
6
7
{
    "task_id": 1,
    "value": 2,
    "user_id": 1,
    "job_type_id": 1,
    "record_date": "2015-04-27"
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
    "single": {
        "id": 2,
        "class": "TimeRecord",
        "url_path": "\/projects\/1\/time-records\/2",
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "billable_status": 1,
        "value": 2,
        "record_date": 1430092800,
        "summary": null,
        "user_id": 1,
        "parent_type": "Task",
        "parent_id": 1,
        "created_on": 1430165043,
        "created_by_id": 1,
        "updated_on": 1430165043,
        "updated_by_id": 1,
        "job_type_id": 1
    }
}
Response: HTTP 200, application/json (Hide)
POST /projects/1/time-records

Payload:

1
2
3
4
5
6
7
{
    "task_id": 1,
    "value": 4,
    "user_id": 1,
    "job_type_id": 1,
    "record_date": "2015-04-27"
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
    "single": {
        "id": 3,
        "class": "TimeRecord",
        "url_path": "\/projects\/1\/time-records\/3",
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "billable_status": 1,
        "value": 4,
        "record_date": 1430092800,
        "summary": null,
        "user_id": 1,
        "parent_type": "Task",
        "parent_id": 1,
        "created_on": 1430165043,
        "created_by_id": 1,
        "updated_on": 1430165043,
        "updated_by_id": 1,
        "job_type_id": 1
    }
}

At this point, we can run a report. Notice that we said to filter to include_tracking_data (query time records and estimated). This switch is off by default, so we have to turn it on. We are turning off subtasks for perforance reasons - they will not return any useful info in this scenario anyway:

Response: HTTP 200, application/json (Hide)
GET /reports/run

Query Parameters:

1
2
3
4
5
{
    "type": "AssignmentFilter",
    "include_tracking_data": true,
    "include_subtasks": false
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
    "all": {
        "label": "All Assignments",
        "assignments": {
            "1": {
                "id": 1,
                "type": "Task",
                "project_id": 1,
                "assignee_id": 0,
                "task_list_id": 0,
                "name": "Task with an estimate",
                "body": null,
                "created_on": 1430165042,
                "age": 0,
                "created_by_id": 1,
                "created_by_name": "ilija.studen",
                "created_by_email": "ilija.studen@activecollab.com",
                "due_on": null,
                "completed_on": null,
                "completed_by_id": null,
                "completed_by_name": null,
                "completed_by_email": null,
                "is_important": false,
                "task_number": "1",
                "estimated_time": 8,
                "estimated_job_type_id": 1,
                "project": "Test Project",
                "task_list": null,
                "assignee": null,
                "created_by": "ilija.studen",
                "completed_by": null,
                "labels": [],
                "permalink": "http:\/\/feather.dev\/projects\/1\/tasks\/1",
                "tracked_time": 6
            }
        }
    }
}

It's as easy as that. All other assignment filter and grouping options are available and you will get the data in estimated_time, estimated_job_type_id and tracked_time columns.