blib/lib/App/karr/Foundation/Picker.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 26 CC 2 SCAR 12.0
CC
2
Cov
0%
next_ticket
6.0
json
2.0
quiet
2.0
CRAP 3.3
1 # ABSTRACT: karr-foundation ticket selection -- the one card a ticket-mode run is about
2  
3 package App::karr::Foundation::Picker;
4 our $VERSION = '0.602';
5 use Moo;
6 use App::karr::Role::PickRules;
7  
8  
9  
10 has store => (
11 is => 'ro',
12 required => 1,
13 );
14  
15 # The two names App::karr::Role::ClaimTimeout requires beyond store, wanted for
16 # check_claim's reporting half (its expired_claim_report), which nothing here
17 # calls -- selection only ever asks _claim_expired. foundation has no --json and
18 # no --quiet, and it says what it did through .karr.log, so these answer for the
19 # shape of that: never JSON, never printing.
20 sub json { 0 }
21 sub quiet { 1 }
22  
23  
24 # Composed here, not at the top of the file: Moo applies a role at the point the
25 # "with" stands, and the role chain requires the three names above it.
26 with 'App::karr::Role::PickRules';
27  
28 sub next_ticket {
29 my ( $self ) = @_;
30  
31 # No filters: `karr pick` narrows this same test with --status and --tags,
32 # foundation asks it unnarrowed. And only the first card -- the rest of the
33 # ranking is for pick, which walks it when a candidate is lost to a lock.
34 my ( $first ) = $self->pick_candidates( [ $self->store->load_tasks ] );
35 return undef unless $first;
36 return $first->id;
37 }
38  
39  
40 1;
41  
42 __END__