switch recheck completion handling into a step
[scpubgit/DX.git] / lib / DX / Step / CompleteRecheck.pm
CommitLineData
251177ea 1package DX::Step::CompleteRecheck;
2
3use DX::Class;
4
5with 'DX::Role::Step';
6
7has was_recheck_for => (is => 'ro', required => 1);
8
9has original_search_state => (is => 'ro', required => 1);
10
11sub apply_to {
12 my ($self, $ss) = @_;
13
14 my $prop = $self->was_recheck_for;
15 my $re_ss = $self->original_search_state;
16 my $re_hyp = $re_ss->current_hypothesis;
17 my $re_rsp = $re_hyp->resolved_propositions;
18
19 my $rsp = $re_rsp->with_updated_dependencies_for(
20 $prop,
21 $ss->current_hypothesis
22 ->resolved_propositions
23 ->dependencies_for($prop)
24 );
25
26 return $re_ss->but(
27 current_hypothesis => $re_hyp->but(
28 resolved_propositions => $rsp
29 ),
30 is_solution_state => 1
31 );
32}
33
341;