From db01f348c1a26604416330b28014a3c8ae6fcba2 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Thu, 1 Mar 2018 15:41:40 +0000 Subject: [PATCH] Add ability to guess the phase we want to progress to --- opentech/apply/funds/workflow.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/opentech/apply/funds/workflow.py b/opentech/apply/funds/workflow.py index bc03146eb..c60c6c08c 100644 --- a/opentech/apply/funds/workflow.py +++ b/opentech/apply/funds/workflow.py @@ -142,8 +142,15 @@ class Stage(Iterable): def get_phase(self, phase_name: str) -> 'Phase': for phase in self.phases: - if str(phase) == phase_name: + if phase == phase_name: return phase + + # We don't have the exact name + for phase in self.phases: + if phase._internal == phase_name: + # Grab the first phase to match the name + return phase + return None def first(self) -> 'Phase': @@ -263,7 +270,7 @@ class ChangePhaseAction(Action): def process(self, phase: 'Phase') -> Union['Phase', None]: if isinstance(self.target_phase, str): - return phase.stage.get_phase(phase_name(phase.stage, self.target_phase, 0)) + return phase.stage.get_phase(self.target_phase ) return self.target_phase -- GitLab