#4250 Vorgänge zählen nicht hoch

This commit is contained in:
Lorenz Hilpert
2023-08-09 16:50:54 +02:00
parent 516465db37
commit 6ee1b0a7f8

View File

@@ -68,15 +68,19 @@ export class ShellProcessBarComponent implements OnInit {
setTimeout(() => this.scrollToEnd(), 25);
}
static REGEX_PROCESS_NAME = /^Vorgang \d+$/;
async createCartProcess() {
const processes = await this._app.getProcesses$('customer').pipe(first()).toPromise();
const count = processes.filter((x) => x.type === 'cart' && x.name.startsWith('Vorgang ')).length;
const processIds = processes.filter((x) => ShellProcessBarComponent.REGEX_PROCESS_NAME.test(x.name)).map((x) => +x.name.split(' ')[1]);
const maxId = processIds.length > 0 ? Math.max(...processIds) : 0;
const process: ApplicationProcess = {
id: Date.now(),
type: 'cart',
name: `Vorgang ${count + 1}`,
name: `Vorgang ${maxId + 1}`,
section: 'customer',
closeable: true,
};