Add getLastCommitedStateIndex
This commit is contained in:
parent
965f5da9a9
commit
13731da7e1
@ -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 {
|
public getStateFromId(process: Process, stateId: string): ProcessState | null {
|
||||||
if (process.states.length === 0) return null;
|
if (process.states.length === 0) return null;
|
||||||
const state = process.states.find(state => state.state_id === stateId);
|
const state = process.states.find(state => state.state_id === stateId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user