JPList/Controls/Sort.pm

filter: Statementstmt 100% 17 / 17 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 3 / 3 Podpod 100% 2 / 2 totaltotal 75.6% 28 / 37 CC 6 SCAR 16.5
CC
6
Cov
79%
sortdropdown
6.6
BEGIN
1.0
sortselect
1.0
CRAP 5.2
« JPList/Controls/Filter.pm ↑ Summary JPList.pm »
1 # ========================================================================== #
2 # lib/JPList/Controls/Sort.pm - JPList Sort controls
3 # Copyright (C) 2017 Exceleron Software, LLC
4 # ========================================================================== #
5  
6 package JPList::Controls::Sort;
7  
8 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ========================================================================== #
11  
12 =head1 NAME
13  
14 JPList::Controls::Sort - JPList Sort controls
15  
16 =head1 VERSION
17  
18 Version 0.04
19  
20 =cut
21  
22 2 our $VERSION = '0.04';
23  
24 =head1 SYNOPSIS
25  
26 with 'JPList::Controls::Sort'
27  
28 =head1 DESCRIPTION
29  
30 The Sort module allows you get the values sort controls
31  
32 =head2 METHODS
33  
34 =over 4
35  
36 =cut
37  
38 # ========================================================================== #
39  
40 =item C<sortdropdown>
41  
42 Params : sort_vals
43  
44 {
45 'type' => 'sort-drop-down',
46 'inStorage' => $VAR1->[0]{'inDeepLinking'},
47 'inAnimation' => $VAR1->[0]{'inDeepLinking'},
48 'name' => 'sort',
49 'data' => {
50 'order' => '',
51 'type' => '',
52 'dateTimeFormat' => '',
53 'path' => 'default',
54 'ignore' => ''
55 },
56 'initialIndex' => 1,
57 'inDeepLinking' => $VAR1->[0]{'inDeepLinking'},
58 'action' => 'sort',
59 'isAnimateToTop' => $VAR1->[0]{'isAnimateToTop'}
60 }
61  
62 Returns: Returns the column and value for order
63  
64 Desc : Returns the column and value for order
65  
66 =cut
67  
68 sub sortdropdown
69 8 ▶{
Subroutine sortdropdown: called CC=6 SCAR=18.9
Pod documented
70 8 my ($self, $sort_vals) = @_;
71  
72 8 my $data = $sort_vals->{'data'};
73 8 my $result;
74 8 my $order = "asc";
75  
76 8 ▶ if ($data && exists($data->{'path'}) && $data->{'path'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data and exists $data->{"path"} and $data->{"path"}) 8 0 8
Condition33%2/6
$data and exists $data->{"path"} and $data->{"path"}
!ll&&!rl&&r
008
$data and exists $data->{"path"}
!ll&&!rl&&r
008
MC/DC0%0/3
$data and exists $data->{"path"} and $data->{"path"}
$data exists $data->{"path"} $data->{"path"}
Truth table25%1/4
A and B and C
A= $dataB= exists $data->{"path"}C= $data->{"path"}
ABCresult
0XX0
10X0
1100
1111
77  
78 8 $result->{'column'} = $data->{'path'};
79 8 $result->{'column'} =~ s/\.//;
80  
81 8 ▶ if (exists($data->{'order'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $data->{"order"}) 8 0 8
82 8 $order = lc($data->{'order'});
83 }
84  
85 8 ▶ $result->{'order'} = ($order eq "desc") ? "desc" : "asc";
Branch: 1 branch
BranchTrueFalseTotal
$order eq 'desc' ? : 2 6 8
86 }
87  
88 8 return $result;
89 }
90  
91 # ========================================================================== #
92  
93 =item C<sortselect>
94  
95 Params : sort_vals
96  
97 {
98 'type' => 'sort-select',
99 'action' => 'sort',
100 'inStorage' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
101 'data' => {
102 'order' => '',
103 'type' => '',
104 'dateTimeFormat' => '{month}/{day}/{year}',
105 'path' => 'default',
106 'ignore' => ''
107 },
108 'isAnimateToTop' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
109 'inDeepLinking' => $VAR1->[0]{'inStorage'},
110 'name' => 'sort',
111 'inAnimation' => $VAR1->[0]{'inStorage'}
112 }
113  
114 Returns: Returns the column and value for order
115  
116 Desc : Returns the column and value for order
117  
118 =cut
119  
120 sub sortselect
121 1 ▶{
Subroutine sortselect: called CC=1 SCAR=0.0
Pod documented
122 1 shift->sortdropdown(@_);
123 }
124  
125 2 1;
126  
127 __END__
« JPList/Controls/Filter.pm ↑ Summary JPList.pm »