From ed0f9ce0460c3f94f69c4a04ffd9bfffa2a81779 Mon Sep 17 00:00:00 2001 From: adkif <45813955+adkif@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:25:18 +0200 Subject: [PATCH] refactor: async-await usage in conflict deletion logic to prevent map misuse --- packages/core/src/time-tracking/timer/timer.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/time-tracking/timer/timer.service.ts b/packages/core/src/time-tracking/timer/timer.service.ts index 3480f03928f..bdb7b59d4a3 100644 --- a/packages/core/src/time-tracking/timer/timer.service.ts +++ b/packages/core/src/time-tracking/timer/timer.service.ts @@ -378,11 +378,11 @@ export class TimerService { // Delete conflicts await Promise.all( - await conflicts.flatMap((timeLog: ITimeLog) => { + conflicts.flatMap((timeLog: ITimeLog) => { const { timeSlots = [] } = timeLog; - timeSlots.map(async (timeSlot: ITimeSlot) => { - await this.commandBus.execute(new DeleteTimeSpanCommand(times, timeLog, timeSlot)); - }); + return timeSlots.map((timeSlot: ITimeSlot) => + this.commandBus.execute(new DeleteTimeSpanCommand(times, timeLog, timeSlot)) + ); }) ); }