feat: update task with all repeat cfg value after first making it repeatable #3101

This commit is contained in:
Johannes Millan 2025-01-03 16:51:15 +01:00
parent c0cb8f6e26
commit d915efb42c

View file

@ -1,11 +1,13 @@
import { Injectable, inject } from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import {
concatMap,
delay,
filter,
first,
map,
mergeMap,
switchMap,
take,
tap,
withLatestFrom,
@ -147,6 +149,26 @@ export class TaskRepeatCfgEffects {
{ dispatch: false },
);
updateTaskAfterMakingItRepeatable$: any = createEffect(
() =>
this._actions$.pipe(
ofType(addTaskRepeatCfgToTask),
switchMap(({ taskRepeatCfg, taskId }) => {
return this._taskService.getByIdOnce$(taskId).pipe(
first(),
map((task) => ({
task,
taskRepeatCfg,
})),
);
}),
tap(({ task, taskRepeatCfg }) => {
this._updateRegularTaskInstance(task, taskRepeatCfg, taskRepeatCfg);
}),
),
{ dispatch: false },
);
checkToUpdateAllTaskInstances: any = createEffect(
() =>
this._actions$.pipe(