From 64a71a366378038bbdbf6eb22b43e96d0db8b220 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 26 Sep 2020 14:58:13 +0200 Subject: [PATCH] flows: fix planner removing too many stages --- passbook/flows/planner.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/passbook/flows/planner.py b/passbook/flows/planner.py index a730716c8..a732cf9ad 100644 --- a/passbook/flows/planner.py +++ b/passbook/flows/planner.py @@ -46,22 +46,24 @@ class FlowPlan: self.stages.append(stage) self.markers.append(marker or StageMarker()) - def next(self, offset=0) -> Optional[Stage]: + def next(self) -> Optional[Stage]: """Return next pending stage from the bottom of the list""" if not self.has_stages: return None - stage = self.stages[offset] - marker = self.markers[offset] + stage = self.stages[0] + marker = self.markers[0] if marker.__class__ is not StageMarker: LOGGER.debug("f(plan_inst): stage has marker", stage=stage, marker=marker) marked_stage = marker.process(self, stage) if not marked_stage: LOGGER.debug("f(plan_inst): marker returned none, next stage", stage=stage) + self.stages.remove(stage) + self.markers.remove(marker) if not self.has_stages: return None # pylint: disable=not-callable - return self.next(offset + 1) + return self.next() return marked_stage def pop(self):