| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::bif::log::project; | 
| 2 | 1 |  |  | 1 |  | 4893 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 3 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 36 |  | 
| 4 | 1 |  |  | 1 |  | 6 | use feature 'state'; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 80 |  | 
| 5 | 1 |  |  | 1 |  | 5 | use Bif::Mo; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '0.1.5_6'; | 
| 8 |  |  |  |  |  |  | extends 'App::bif::log'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub run { | 
| 11 | 1 |  |  | 1 | 1 | 2 | my $self = shift; | 
| 12 | 1 |  |  |  |  | 6 | my $opts = $self->opts; | 
| 13 | 1 |  |  |  |  | 9 | my $db   = $self->db; | 
| 14 | 0 |  |  |  |  |  | my $info = $self->get_project( $opts->{path} ); | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 0 |  |  |  |  |  | state $have_dbix = DBIx::ThinSQL->import(qw/ qv concat /); | 
| 17 | 0 |  |  |  |  |  | my $now = $self->now; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | my $sth = $db->xprepare( | 
| 20 |  |  |  |  |  |  | select => [ | 
| 21 |  |  |  |  |  |  | 'project_deltas.project_id AS id', | 
| 22 |  |  |  |  |  |  | 'SUBSTR(n.uuid,1,8) AS uuid', | 
| 23 |  |  |  |  |  |  | concat( qv('c'), 'changes.id' )->as('change_id'), | 
| 24 |  |  |  |  |  |  | 'SUBSTR(changes.uuid,1,8) AS change_uuid', | 
| 25 |  |  |  |  |  |  | 'project_deltas.title', | 
| 26 |  |  |  |  |  |  | 'changes.mtime AS mtime', | 
| 27 |  |  |  |  |  |  | "changes.mtimetz AS mtimetz", | 
| 28 |  |  |  |  |  |  | 'changes.mtimetzhm AS mtimetzhm', | 
| 29 |  |  |  |  |  |  | "$now - changes.mtime AS mtime_age", | 
| 30 |  |  |  |  |  |  | 'changes.action', | 
| 31 |  |  |  |  |  |  | 'COALESCE(changes.author,e.name) AS author', | 
| 32 |  |  |  |  |  |  | 'COALESCE(changes.author_contact,ecm.mvalue) AS contact', | 
| 33 |  |  |  |  |  |  | 'changes.message', | 
| 34 |  |  |  |  |  |  | 'changes_tree.depth', | 
| 35 |  |  |  |  |  |  | 'project_status.status', | 
| 36 |  |  |  |  |  |  | 'project_status.status', | 
| 37 |  |  |  |  |  |  | 'n.path', | 
| 38 |  |  |  |  |  |  | 'nd.name', | 
| 39 |  |  |  |  |  |  | ], | 
| 40 |  |  |  |  |  |  | from       => 'project_deltas', | 
| 41 |  |  |  |  |  |  | inner_join => 'node_deltas nd', | 
| 42 |  |  |  |  |  |  | on         => 'nd.id = project_deltas.id', | 
| 43 |  |  |  |  |  |  | inner_join => 'projects', | 
| 44 |  |  |  |  |  |  | on         => 'projects.id = project_deltas.project_id', | 
| 45 |  |  |  |  |  |  | inner_join => 'nodes n', | 
| 46 |  |  |  |  |  |  | on         => 'n.id = projects.id', | 
| 47 |  |  |  |  |  |  | inner_join => 'changes_tree', | 
| 48 |  |  |  |  |  |  | on         => 'changes_tree.parent = n.first_change_id AND | 
| 49 |  |  |  |  |  |  | changes_tree.child = project_deltas.change_id', | 
| 50 |  |  |  |  |  |  | inner_join => 'changes', | 
| 51 |  |  |  |  |  |  | on         => 'changes.id = changes_tree.child', | 
| 52 |  |  |  |  |  |  | inner_join => 'entities e', | 
| 53 |  |  |  |  |  |  | on         => 'e.id = changes.identity_id', | 
| 54 |  |  |  |  |  |  | inner_join => 'entity_contact_methods ecm', | 
| 55 |  |  |  |  |  |  | on         => 'ecm.id = e.default_contact_method_id', | 
| 56 |  |  |  |  |  |  | left_join  => 'project_status', | 
| 57 |  |  |  |  |  |  | on         => 'project_status.id = project_deltas.project_status_id', | 
| 58 |  |  |  |  |  |  | where      => { | 
| 59 |  |  |  |  |  |  | 'project_deltas.project_id' => $info->{id}, | 
| 60 |  |  |  |  |  |  | }, | 
| 61 | 0 |  |  |  |  |  | order_by => 'changes.path asc', | 
| 62 |  |  |  |  |  |  | ); | 
| 63 |  |  |  |  |  |  |  | 
| 64 | 0 |  |  |  |  |  | $sth->execute; | 
| 65 |  |  |  |  |  |  |  | 
| 66 | 0 |  |  |  |  |  | $self->start_pager; | 
| 67 |  |  |  |  |  |  |  | 
| 68 | 0 |  |  |  |  |  | my $first = $sth->hashref; | 
| 69 | 0 |  |  |  |  |  | $first->{ctime}     = $first->{mtime}; | 
| 70 | 0 |  |  |  |  |  | $first->{ctimetz}   = $first->{mtimetz}; | 
| 71 | 0 |  |  |  |  |  | $first->{ctimetzhm} = $first->{mtimetzhm}; | 
| 72 | 0 |  |  |  |  |  | $first->{ctime_age} = $first->{mtime_age}; | 
| 73 | 0 |  |  |  |  |  | $self->log_item( $first, 'project', [ 'Phase', $first->{status} ] ); | 
| 74 |  |  |  |  |  |  |  | 
| 75 | 0 |  |  |  |  |  | $self->log_comment($_) for $sth->hashrefs; | 
| 76 |  |  |  |  |  |  |  | 
| 77 | 0 |  |  |  |  |  | return $self->ok('LogProject'); | 
| 78 |  |  |  |  |  |  | } | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | 1; | 
| 81 |  |  |  |  |  |  | __END__ |