From c24e0aa529c601f4e1a9fbcb98f1bd488290142c Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Fri, 30 Aug 2019 21:46:25 +0200 Subject: [PATCH] Fixed bug similar to Munchen bug - on multiple hits of the same diverison (or one that shares messages) it went back to old moment in the story --- hugvey/story.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hugvey/story.py b/hugvey/story.py index 9d411b4..572ef17 100644 --- a/hugvey/story.py +++ b/hugvey/story.py @@ -814,6 +814,7 @@ class Diversion(object): story.add(condition2) direction.isDiversionReturn = True # will clear the currentDiversion on story + story.diversionDirections.append(direction) story.logger.info(f"Created direction: {direction.id} ({msg.id} -> {usedReturnMessage.id}) {condition.id} with timeout {finalTimeoutDuration}s") story.add(condition) story.add(direction) @@ -1399,6 +1400,7 @@ class Story(object): self.variableValues = {} # captured variables from replies self.finish_time = False self.runId = uuid.uuid4().hex + self.diversionDirections = [] self.events = [] # queue of received events self.commands = [] # queue of commands to send @@ -1602,10 +1604,16 @@ class Story(object): if not isDiverging and chosenDirection: if chosenDirection.isDiversionReturn and self.currentDiversion: - chosenDirection.diversionHasReturned = True + for direction in self.diversionDirections: + if direction.isDiversionReturn and not direction.diversionHasReturned: + self.logger.info(f"Mark diversion as returned for return direction {direction.id}") + direction.diversionHasReturned = True + +# chosenDirection.diversionHasReturned = True await self.currentDiversion.finalise(self) await self.setCurrentMessage(chosenDirection.msgTo, allowReplyInterrupt=allowReplyInterrupt) + return chosenDirection