blib/lib/Tapper/Reports/Web/Controller/Tapper/Rss.pm

filter: Statementstmt 33.9% 18 / 53 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 31.5% 23 / 73 CC 8 SCAR 38.0
CC
8
Cov
28%
index
72.0
BEGIN
1.0
BEGIN
1.0
CRAP 44.7
« blib/lib/Tapper/Reports/Web/Controller/Tapper/ContinuousTestruns.pm ↑ Summary blib/lib/Tapper/Reports/Web/Controller/Tapper/Overview.pm »
1 package Tapper::Reports::Web::Controller::Tapper::Rss;
2 13 our $AUTHORITY = 'cpan:TAPPER';
3 13 $Tapper::Reports::Web::Controller::Tapper::Rss::VERSION = '5.0.17';
4 13 ▶use XML::Feed;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 13 ▶use Tapper::Reports::Web::Util::Filter::Report;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 13 ▶use parent 'Catalyst::Controller';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 ## no critic (RequireUseStrict)
11  
12  
13 0 ▶sub index :Path :Args()
Subroutine index: not called CC=8 SCAR=42.8
14 {
15 0 my ($self,$c, @args) = @_;
16  
17 0 my $filter = Tapper::Reports::Web::Util::Filter::Report->new(context => $c);
18 0 my $dtf = $c->model("TestrunDB")->storage->datetime_parser;
19  
20 0 my $feed = XML::Feed->new('RSS');
21 0 $feed->title( 'Tapper RSS Feed' );
22 0 $feed->link( $c->req->base ); # link to the site.
23 0 $feed->description('Tapper Reports ');
24  
25 0 my $feed_entry;
26 my $title;
27  
28 0 my $filter_condition;
29  
30 0 $filter_condition = $filter->parse_filters(\@args);
31 0 ▶ if ( defined $filter_condition->{error} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $filter_condition->{"error"}) 0 0 0
32 0 $feed_entry = XML::Feed::Entry->new('RSS');
33 0 $feed_entry->title( $filter_condition->{error} );
34 0 $feed_entry->issued( DateTime->now );
35 0 $feed->add_entry($feed_entry);
36 }
37  
38 # default 2 days
39 0 ▶ if (not $filter_condition->{early}{created_at}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($filter_condition->{"early"}{"created_at"}) 0 0 0
40 0 my $now = DateTime->now();
41 0 $now->subtract(days => 2);
42 0 $filter_condition->{early}{created_at} = {'>' => $dtf->format_datetime($now) };
43 }
44  
45  
46 my $reports = $c->model('TestrunDB')->resultset('Report')->search
47 (
48 $filter_condition->{early},
49 {
50 0 columns => [ qw( id
51 suite_id
52 created_at
53 machine_name
54 success_ratio
55 successgrade
56 total
57 )],
58 }
59 );
60 0 foreach my $filter (@{$filter_condition->{late}}) {
61 0 $reports = $reports->search($filter);
62 }
63  
64  
65 # Process the entries
66 0 ▶ while (my $report = $reports->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $report = $reports->next) 0 0 0
67 0 $feed_entry = XML::Feed::Entry->new('RSS');
68 0 $title = $report->successgrade;
69 0 ▶ $title .= " ".($report->success_ratio // 0)."%";
Condition0%0/2
$report->success_ratio // 0
l!l
00
MC/DC0%0/1
$report->success_ratio // 0
$report->success_ratio
Truth table0%0/2
A
A= $report->success_ratio
Aresult
11
00
70 0 ▶ $title .= " ".($report->suite ? $report->suite->name : 'unknown suite');
Branch: 1 branch
BranchTrueFalseTotal
$report->suite ? : 0 0 0
71 0 $title .= " @ ";
72 0 ▶ $title .= $report->machine_name || 'unknown machine';
Condition0%0/2
$report->machine_name || 'unknown machine'
l!l
00
MC/DC0%0/1
$report->machine_name || 'unknown machine'
$report->machine_name
Truth table0%0/2
A
A= $report->machine_name
Aresult
11
00
73 0 $feed_entry->title( $title );
74 0 $feed_entry->link( $c->req->base->as_string.'tapper/reports/id/'.$report->id );
75 0 $feed_entry->issued( $report->created_at );
76 0 $feed->add_entry($feed_entry);
77 }
78  
79 0 $c->res->body( $feed->as_xml );
80 13 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
81  
82 13 1;
83  
84 __END__
« blib/lib/Tapper/Reports/Web/Controller/Tapper/ContinuousTestruns.pm ↑ Summary blib/lib/Tapper/Reports/Web/Controller/Tapper/Overview.pm »