XTaTIK/Controller/Cart.pm

filter: Statementstmt 50.0% 11 / 22 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 37.8% 14 / 37 CC 5 SCAR 23.6
CC
5
Cov
39%
add
20.0
index
6.0
BEGIN
1.0
CRAP 10.6
« XTaTIK/Common.pm ↑ Summary XTaTIK/Utilities/Misc.pm »
1 package XTaTIK::Controller::Cart;
2  
3 1 our $VERSION = '0.005003'; # VERSION
4  
5 1 ▶use Mojo::Base 'Mojolicious::Controller';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use XTaTIK::Common qw/n_to_br set_product_pic/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use experimental 'postderef';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub index {
Subroutine index: not called CC=2 SCAR=17.9
Pod undocumented
10 0 my $self = shift;
11  
12 0 my %items = $self->cart->all_items_cart_quote_kv;
13 0 for ( $items{cart}->@*, $items{quote}->@*) {
14 0 set_product_pic( $self, @$_{qw/image number/} );
15 }
16 0 $self->stash( %items );
17 };
18  
19 0 ▶sub add {
Subroutine add: not called CC=4 SCAR=30.0
Pod undocumented
20 0 my $self = shift;
21  
22 0 my $p = $self->cart
23 ->add( $self->param('quantity'), $self->param('number') );
24  
25 0 $self->cart_dollars('refresh'); $self->cart_cents('refresh');
26 0 $self->cart->save;
27 $self->stash(
28 number => $self->param('number'),
29 quantity => $self->param('quantity'),
30 0 ▶ is_quote => $p->{price}//-1 == -1 ? 1 : 0,
Branch: 1 branch
BranchTrueFalseTotal
$p->{'price'} // !0 ? : 0 0 0
Condition0%0/4
$p->{"price"} //
l!l
00
$self->req->headers->referrer || '/products'
l!l
00
MC/DC0%0/1
$p->{"price"} //
$p->{"price"}
MC/DC0%0/1
$self->req->headers->referrer || '/products'
$self->req->headers->referrer
Truth table0%0/2
A
A= $p->{"price"}
Aresult
11
00
Truth table0%0/2
A
A= $self->req->headers->referrer
Aresult
11
00
31 return_to => $self->req->headers->referrer || '/products',
32 );
33 };
34  
35  
36  
37  
38  
39 1 1;
« XTaTIK/Common.pm ↑ Summary XTaTIK/Utilities/Misc.pm »