Skip to content

Commit

Permalink
refactor: async-await usage in conflict deletion logic to prevent map…
Browse files Browse the repository at this point in the history
… misuse
  • Loading branch information
adkif committed Sep 23, 2024
1 parent c61f9ae commit ed0f9ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/time-tracking/timer/timer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
);
})
);
}
Expand Down

0 comments on commit ed0f9ce

Please sign in to comment.