Add getLastCommitedStateIndex

This commit is contained in:
NicolasCantu 2025-06-25 14:38:52 +02:00
parent 965f5da9a9
commit 13731da7e1

View File

@ -1435,6 +1435,17 @@ export default class Services {
}
}
public getLastCommitedStateIndex(process: Process): number | null {
if (process.states.length === 0) return null;
const processTip = process.states[process.states.length - 1].commited_in;
for (let i = process.states.length - 1; i >= 0; i--) {
if (process.states[i].commited_in !== processTip) {
return i;
}
}
return null;
}
public getStateFromId(process: Process, stateId: string): ProcessState | null {
if (process.states.length === 0) return null;
const state = process.states.find(state => state.state_id === stateId);