File Coverage

blib/lib/App/bif/log/issue.pm
Criterion Covered Total %
statement 15 29 51.7
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 21 35 60.0


line stmt bran cond sub pod time code
1             package App::bif::log::issue;
2 1     1   4369 use strict;
  1         2  
  1         34  
3 1     1   4 use warnings;
  1         1  
  1         42  
4 1     1   4 use feature 'state';
  1         1  
  1         87  
5 1     1   3 use Bif::Mo;
  1         1  
  1         8  
6              
7             our $VERSION = '0.1.5_5';
8             extends 'App::bif::log';
9              
10             sub run {
11 1     1 1 1 my $self = shift;
12 1         4 my $opts = $self->opts;
13 1         7 my $db = $self->db;
14 0           my $info = $self->get_node( $opts->{id}, 'issue' );
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             'id.issue_id AS id',
22             concat( qv('c'), 'c.id' )->as('change_id'),
23             'SUBSTR(c.uuid,1,8) AS change_uuid',
24             'c.mtime AS mtime',
25             "c.mtimetz AS mtimetz",
26             'c.mtimetzhm AS mtimetzhm',
27             "$now - c.mtime AS mtime_age",
28             'c.action',
29             'COALESCE(c.author,e.name) AS author',
30             "COALESCE(c.author_contact_method || ': ' || "
31             . "c.author_contact, ecm.method || ': ' || "
32             . "ecm.mvalue) AS contact",
33             'c.message',
34             'c.ucount',
35             'ist.status',
36             'id.title',
37             'ct.depth',
38             ],
39             from => 'changes_tree ct',
40             inner_join => 'changes c',
41             on => 'c.id = ct.child',
42             inner_join => 'entities e',
43             on => 'e.id = c.identity_id',
44             inner_join => 'entity_contact_methods ecm',
45             on => 'ecm.id = e.default_contact_method_id',
46             inner_join => 'issue_deltas id',
47             on => 'id.change_id = c.id',
48             inner_join => 'issues i',
49             on => 'i.id = id.issue_id',
50             left_join => 'projects p',
51             on => 'p.id = i.project_id',
52             left_join => 'issue_status ist',
53             on => 'ist.id = id.issue_status_id',
54             where => {
55             'ct.parent' => $info->{first_change_id},
56             },
57 0           order_by => 'c.path ASC',
58             );
59              
60 0           $sth->execute;
61 0           $self->start_pager;
62              
63 0           my $first = $sth->hashref;
64 0           $first->{ctime} = $first->{mtime};
65 0           $first->{ctimetz} = $first->{mtimetz};
66 0           $first->{ctimetzhm} = $first->{mtimetzhm};
67 0           $first->{ctime_age} = $first->{mtime_age};
68 0           $self->log_item( $first, 'issue' );
69              
70 0           $self->log_comment($_) for $sth->hashrefs;
71              
72 0           return $self->ok('LogIssue');
73             }
74              
75             1;
76             __END__