« blib/lib/Tapper/Reports/Web/Controller/Tapper/Reports.pm
↑ Summary
blib/lib/Tapper/Reports/Web/Util/Filter.pm »
| 1 | package Tapper::Reports::Web::Util::Filter::Testrun; | ||||||||||||
| 2 | 14 | our $AUTHORITY = 'cpan:TAPPER'; | |||||||||||
| 3 | 14 | $Tapper::Reports::Web::Util::Filter::Testrun::VERSION = '5.0.17'; | |||||||||||
| 4 | |||||||||||||
| 5 | |||||||||||||
| 6 | |||||||||||||
| 7 | |||||||||||||
| 8 | 14 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 14 | ▶ | use Hash::Merge::Simple 'merge'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 14 | ▶ | use Set::Intersection 'get_intersection'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | |||||||||||||
| 12 | 14 | ▶ | use Tapper::Model 'model'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | |||||||||||||
| 14 | 14 | extends 'Tapper::Reports::Web::Util::Filter'; | |||||||||||
| 15 | |||||||||||||
| 16 | 0 | ▶ | sub BUILD { | ||||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 17 | |||||||||||||
| 18 | 0 | my $self = shift; | |||||||||||
| 19 | 0 | my $args = shift; | |||||||||||
| 20 | |||||||||||||
| 21 | $self->dispatch( | ||||||||||||
| 22 | merge( | ||||||||||||
| 23 | $self->dispatch, | ||||||||||||
| 24 | { | ||||||||||||
| 25 | host => \&host, | ||||||||||||
| 26 | owner => \&owner, | ||||||||||||
| 27 | resource => \&resource, | ||||||||||||
| 28 | 0 | ▶ | state => sub { hr_set_filter_default( @_, 'state' ); }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 29 | 0 | ▶ | success => sub { hr_set_filter_default( @_, 'success' ); }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 30 | 0 | ▶ | topic => sub { hr_set_filter_default( @_, 'topic' ); }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 31 | 0 | ▶ | idlist => sub { hr_set_filter_default( @_, 'testrun_id' ); }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 32 | } | ||||||||||||
| 33 | ) | ||||||||||||
| 34 | 0 | ); | |||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | |||||||||||||
| 38 | |||||||||||||
| 39 | sub host | ||||||||||||
| 40 | 0 | ▶ | { | ||||||||||
|
Subroutine
host: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 41 | 0 | my ($self, $filter_condition, $host) = @_; | |||||||||||
| 42 | 0 | my $host_result = model('TestrunDB')->resultset('Host')->search({name => $host}, {rows => 1})->first; | |||||||||||
| 43 | |||||||||||||
| 44 | # (XXX) do we need to throw an error when someone filters for an unknown host? | ||||||||||||
| 45 | 0 | ▶ | if (not $host_result) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 46 | 0 | return $filter_condition; | |||||||||||
| 47 | } | ||||||||||||
| 48 | |||||||||||||
| 49 | 0 | ▶ | push @{$filter_condition->{host} ||= []}, $host_result->id; | ||||||||||
|
Condition0%0/2
$filter_condition->{"host"} ||= []
MC/DC0%0/1
$filter_condition->{"host"} ||= []
$filter_condition->{"host"}
Truth table0%0/2
A
A= $filter_condition->{"host"}
| |||||||||||||
| 50 | |||||||||||||
| 51 | 0 | return $filter_condition; | |||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | |||||||||||||
| 55 | |||||||||||||
| 56 | sub owner | ||||||||||||
| 57 | 0 | ▶ | { | ||||||||||
|
Subroutine
owner: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 58 | 0 | my ($self, $filter_condition, $owner) = @_; | |||||||||||
| 59 | |||||||||||||
| 60 | 0 | my $owner_result = model('TestrunDB')->resultset('Owner')->search({login => $owner}, {rows => 1})->first; | |||||||||||
| 61 | |||||||||||||
| 62 | 0 | ▶ | if (not $owner_result) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 63 | 0 | $filter_condition->{error} = "No owner with login '$owner' found"; | |||||||||||
| 64 | 0 | return $filter_condition; | |||||||||||
| 65 | } | ||||||||||||
| 66 | |||||||||||||
| 67 | 0 | ▶ | push @{$filter_condition->{owner} ||= []}, $owner_result->id; | ||||||||||
|
Condition0%0/2
$filter_condition->{"owner"} ||= []
MC/DC0%0/1
$filter_condition->{"owner"} ||= []
$filter_condition->{"owner"}
Truth table0%0/2
A
A= $filter_condition->{"owner"}
| |||||||||||||
| 68 | |||||||||||||
| 69 | 0 | return $filter_condition; | |||||||||||
| 70 | } | ||||||||||||
| 71 | |||||||||||||
| 72 | |||||||||||||
| 73 | sub resource | ||||||||||||
| 74 | 0 | ▶ | { | ||||||||||
|
Subroutine
resource: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 75 | 0 | my ($self, $filter_condition, $resource) = @_; | |||||||||||
| 76 | |||||||||||||
| 77 | 0 | my $resource_result = model('TestrunDB')->resultset('Resource')->search({name => $resource})->first; | |||||||||||
| 78 | |||||||||||||
| 79 | 0 | ▶ | if (not $resource_result) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 80 | 0 | $filter_condition->{error} = "No resource with name '$resource' found"; | |||||||||||
| 81 | 0 | return $filter_condition; | |||||||||||
| 82 | } | ||||||||||||
| 83 | |||||||||||||
| 84 | 0 | ▶ | push @{$filter_condition->{resource} ||= []}, $resource_result->id; | ||||||||||
|
Condition0%0/2
$filter_condition->{"resource"} ||= []
MC/DC0%0/1
$filter_condition->{"resource"} ||= []
$filter_condition->{"resource"}
Truth table0%0/2
A
A= $filter_condition->{"resource"}
| |||||||||||||
| 85 | |||||||||||||
| 86 | 0 | return $filter_condition; | |||||||||||
| 87 | } | ||||||||||||
| 88 | |||||||||||||
| 89 | 0 | ▶ | sub hr_set_filter_default { | ||||||||||
|
Subroutine
hr_set_filter_default: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 90 | 0 | my ( $or_self, $hr_filter, $value, $s_filter_name ) = @_; | |||||||||||
| 91 | 0 | ▶ | push @{$hr_filter->{$s_filter_name} ||= []}, $value; | ||||||||||
|
Condition0%0/2
$hr_filter->{$s_filter_name} ||= []
MC/DC0%0/1
$hr_filter->{$s_filter_name} ||= []
$hr_filter->{$s_filter_name}
Truth table0%0/2
A
A= $hr_filter->{$s_filter_name}
| |||||||||||||
| 92 | 0 | return $hr_filter; | |||||||||||
| 93 | } | ||||||||||||
| 94 | |||||||||||||
| 95 | 14 | 1; | |||||||||||
| 96 | |||||||||||||
| 97 | __END__ | ||||||||||||