Skip to content

feat: add repeat subtasks for repeating tasks #427 #2630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const DUMMY_REPEATABLE_TASK: TaskRepeatCfg = {
sunday: false,
tagIds: [],
order: 0,
subTaskIds: ['SUB_TASK__DEFAULT'],
};

const HOUR = 60 * 60 * 1000;
Expand Down Expand Up @@ -55,6 +56,23 @@ describe('selectTaskRepeatCfgsDueOnDay', () => {
expect(resultIds).toEqual(['R1']);
});

it('should return cfg for a far future task WITH sub tasks', () => {
const result = selectTaskRepeatCfgsDueOnDay.projector(
[
dummyRepeatable('R1', {
repeatCycle: 'DAILY',
startDate: '2022-01-10',
subTaskIds: ['ST-1', 'ST-2'],
}),
],
{
dayDate: new Date('2025-11-11'),
},
);
const resultSubTaskIds = result.map((item) => item.subTaskIds);
expect(resultSubTaskIds).toEqual([['ST-1', 'ST-2']]);
});

[
FAKE_MONDAY_THE_10TH,
// eslint-disable-next-line no-mixed-operators
Expand Down
2 changes: 2 additions & 0 deletions src/app/features/task-repeat-cfg/task-repeat-cfg.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface TaskRepeatCfgCopy {
// advanced
notes: string | undefined;
// ... possible sub tasks & attachments
subTaskIds: string[];
}

export type TaskRepeatCfg = Readonly<TaskRepeatCfgCopy>;
Expand Down Expand Up @@ -87,4 +88,5 @@ export const DEFAULT_TASK_REPEAT_CFG: Omit<TaskRepeatCfgCopy, 'id'> = {
order: 0,

notes: undefined,
subTaskIds: [],
};