switch recheck to using an on_completion_step
[scpubgit/DX.git] / lib / DX / Step / CompleteRecheck.pm
1 package DX::Step::CompleteRecheck;
2
3 use DX::Class;
4
5 with 'DX::Role::Step';
6
7 has was_recheck_for => (is => 'ro', required => 1);
8
9 has resume_search_state => (is => 'ro', required => 1);
10
11 sub apply_to {
12   my ($self, $ss) = @_;
13
14   my $prop = $self->was_recheck_for;
15   my $re_ss = $self->resume_search_state;
16   my $re_hyp = $re_ss->current_hypothesis;
17   my $re_rps = $re_hyp->resolved_propositions;
18
19   my $rps = $re_rps->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 => $rps
29     ),
30   );
31 }
32
33 1;