Set previous user on all state changes if required

Fixes: #30
This commit is contained in:
Nadja Reitzenstein 2021-12-05 23:43:36 +01:00
parent 6e91295cc0
commit 6b88191dc5

View File

@ -193,6 +193,18 @@ impl Inner {
pub fn do_state_change(&mut self, new_state: MachineState) { pub fn do_state_change(&mut self, new_state: MachineState) {
let old_state = self.replace_state(new_state); let old_state = self.replace_state(new_state);
// Set "previous user" if state change warrants it
match old_state.state {
Status::InUse(ref user) => {
self.previous = user.clone();
},
Status::ToCheck(ref user) => {
self.previous = Some(user.clone());
},
_ => {},
}
self.reset.replace(old_state); self.reset.replace(old_state);
} }