summaryrefslogtreecommitdiff
path: root/scripts/create-sample-lead-time.php
blob: d4d820068ac520163cae540bd7854ae84223ba39 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env php
<?php

require __DIR__.'/../app/common.php';

use Model\Project;
use Model\ProjectDailyStats;

$p = new Project($container);
$pds = new ProjectDailyStats($container);

$p->create(array('name' => 'Test Lead/Cycle time'));

$container['db']->table('tasks')->insert(array(
    'title' => 'Lead time = 4d | Cycle time = 3d',
    'date_creation' => strtotime('-7 days'),
    'date_started' => strtotime('-6 days'),
    'date_completed' => strtotime('-3 days'),
    'is_active' => 0,
    'project_id' => 1,
    'column_id' => 1,
));

$container['db']->table('tasks')->insert(array(
    'title' => 'Lead time = 1d | Cycle time = 1d',
    'date_creation' => strtotime('-7 days'),
    'date_started' => strtotime('-7 days'),
    'date_completed' => strtotime('-6 days'),
    'is_active' => 0,
    'project_id' => 1,
    'column_id' => 1,
));

$pds->updateTotals(1, date('Y-m-d', strtotime('-6 days')));

$container['db']->table('tasks')->insert(array(
    'title' => 'Lead time = 7d | Cycle time = 5d',
    'date_creation' => strtotime('-7 days'),
    'date_started' => strtotime('-5 days'),
    'date_completed' => strtotime('today'),
    'is_active' => 0,
    'project_id' => 1,
    'column_id' => 1,
));

$pds->updateTotals(1, date('Y-m-d', strtotime('-5 days')));

$container['db']->table('tasks')->insert(array(
    'title' => 'Lead time = 1d | Cycle time = 0',
    'date_creation' => strtotime('-3 days'),
    'date_started' => 0,
    'date_completed' => 0,
    'is_active' => 0,
    'project_id' => 1,
    'column_id' => 1,
));

$pds->updateTotals(1, date('Y-m-d', strtotime('-4 days')));

$container['db']->table('tasks')->insert(array(
    'title' => 'Lead time = 1d | Cycle time = 1d',
    'date_creation' => strtotime('-3 days'),
    'date_started' => strtotime('-3 days'),
    'date_completed' => 0,
    'is_active' => 0,
    'project_id' => 1,
    'column_id' => 1,
));

$pds->updateTotals(1, date('Y-m-d', strtotime('-3 days')));