mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 23:51:32 +00:00
Include last trigger in fsm_update messages
This commit is contained in:
parent
77f14df17b
commit
4236a17b69
@ -28,7 +28,8 @@ class FSMManagingEventHandler(EventHandlerBase):
|
|||||||
LOG.error('IGNORING MESSAGE: Invalid message received: %s', message)
|
LOG.error('IGNORING MESSAGE: Invalid message received: %s', message)
|
||||||
|
|
||||||
def handle_trigger(self, data):
|
def handle_trigger(self, data):
|
||||||
self.fsm.step(data['value'])
|
trigger = data['value']
|
||||||
|
self.fsm.step(trigger)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def handle_update(self, data):
|
def handle_update(self, data):
|
||||||
@ -51,7 +52,9 @@ class FSMUpdater:
|
|||||||
{'trigger': trigger}
|
{'trigger': trigger}
|
||||||
for trigger in self.fsm.get_triggers(self.fsm.state)
|
for trigger in self.fsm.get_triggers(self.fsm.state)
|
||||||
]
|
]
|
||||||
|
last_trigger = self.fsm.trigger_history[-1] if self.fsm.trigger_history else None
|
||||||
return {
|
return {
|
||||||
'current_state': state,
|
'current_state': state,
|
||||||
'valid_transitions': valid_transitions
|
'valid_transitions': valid_transitions,
|
||||||
|
'last_trigger': last_trigger
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user