mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-17 16:37:43 +00:00
fix(tasks): preserve task order when carrying over to next day
Append new tasks after existing ones in TODAY_TAG.taskIds instead of prepending, so manually sorted tasks retain their order across days. Closes #6750
This commit is contained in:
parent
5b9f3f8278
commit
a2d75478fb
3 changed files with 12 additions and 12 deletions
|
|
@ -229,7 +229,7 @@ describe('taskSharedSchedulingMetaReducer', () => {
|
|||
});
|
||||
|
||||
describe('planTasksForToday action', () => {
|
||||
it('should add new tasks to the top of Today tag', () => {
|
||||
it('should append new tasks after existing tasks in Today tag', () => {
|
||||
const testState = createStateWithExistingTasks([], [], [], ['existing-task']);
|
||||
const action = TaskSharedActions.planTasksForToday({
|
||||
taskIds: ['task1', 'task2'],
|
||||
|
|
@ -238,14 +238,14 @@ describe('taskSharedSchedulingMetaReducer', () => {
|
|||
|
||||
metaReducer(testState, action);
|
||||
expectStateUpdate(
|
||||
expectTagUpdate('TODAY', { taskIds: ['task1', 'task2', 'existing-task'] }),
|
||||
expectTagUpdate('TODAY', { taskIds: ['existing-task', 'task1', 'task2'] }),
|
||||
action,
|
||||
mockReducer,
|
||||
testState,
|
||||
);
|
||||
});
|
||||
|
||||
it('should not add tasks that are already in Today tag', () => {
|
||||
it('should preserve existing order when adding new tasks', () => {
|
||||
const testState = createStateWithExistingTasks(
|
||||
[],
|
||||
[],
|
||||
|
|
@ -259,7 +259,7 @@ describe('taskSharedSchedulingMetaReducer', () => {
|
|||
|
||||
metaReducer(testState, action);
|
||||
expectStateUpdate(
|
||||
expectTagUpdate('TODAY', { taskIds: ['task2', 'task1', 'existing-task'] }),
|
||||
expectTagUpdate('TODAY', { taskIds: ['task1', 'existing-task', 'task2'] }),
|
||||
action,
|
||||
mockReducer,
|
||||
testState,
|
||||
|
|
@ -275,7 +275,7 @@ describe('taskSharedSchedulingMetaReducer', () => {
|
|||
|
||||
metaReducer(testState, action);
|
||||
expectStateUpdate(
|
||||
expectTagUpdate('TODAY', { taskIds: ['task2', 'parent-task'] }),
|
||||
expectTagUpdate('TODAY', { taskIds: ['parent-task', 'task2'] }),
|
||||
action,
|
||||
mockReducer,
|
||||
testState,
|
||||
|
|
@ -363,7 +363,7 @@ describe('taskSharedSchedulingMetaReducer', () => {
|
|||
// subtask1 should NOT be added (parent1 is in Today)
|
||||
// subtask2 SHOULD be added (parent2 is not in Today)
|
||||
expectStateUpdate(
|
||||
expectTagUpdate('TODAY', { taskIds: ['subtask2', 'parent1'] }),
|
||||
expectTagUpdate('TODAY', { taskIds: ['parent1', 'subtask2'] }),
|
||||
action,
|
||||
mockReducer,
|
||||
testState,
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ const handlePlanTasksForToday = (
|
|||
{
|
||||
id: TODAY_TAG.id,
|
||||
changes: {
|
||||
taskIds: unique([...newTasksForToday, ...todayTag.taskIds]),
|
||||
taskIds: unique([...todayTag.taskIds, ...newTasksForToday]),
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1866,7 +1866,7 @@ describe('taskSharedMetaReducer', () => {
|
|||
});
|
||||
|
||||
describe('planTasksForToday action', () => {
|
||||
it('should add new tasks to the top of Today tag', () => {
|
||||
it('should append new tasks after existing tasks in Today tag', () => {
|
||||
const testState = createStateWithExistingTasks([], [], [], ['existing-task']);
|
||||
const action = TaskSharedActions.planTasksForToday({
|
||||
taskIds: ['task1', 'task2'],
|
||||
|
|
@ -1874,13 +1874,13 @@ describe('taskSharedMetaReducer', () => {
|
|||
});
|
||||
|
||||
expectStateUpdate(
|
||||
expectTagUpdate('TODAY', { taskIds: ['task1', 'task2', 'existing-task'] }),
|
||||
expectTagUpdate('TODAY', { taskIds: ['existing-task', 'task1', 'task2'] }),
|
||||
action,
|
||||
testState,
|
||||
);
|
||||
});
|
||||
|
||||
it('should not add tasks that are already in Today tag', () => {
|
||||
it('should preserve existing order when adding new tasks', () => {
|
||||
const testState = createStateWithExistingTasks(
|
||||
[],
|
||||
[],
|
||||
|
|
@ -1893,7 +1893,7 @@ describe('taskSharedMetaReducer', () => {
|
|||
});
|
||||
|
||||
expectStateUpdate(
|
||||
expectTagUpdate('TODAY', { taskIds: ['task2', 'task1', 'existing-task'] }),
|
||||
expectTagUpdate('TODAY', { taskIds: ['task1', 'existing-task', 'task2'] }),
|
||||
action,
|
||||
testState,
|
||||
);
|
||||
|
|
@ -1907,7 +1907,7 @@ describe('taskSharedMetaReducer', () => {
|
|||
});
|
||||
|
||||
expectStateUpdate(
|
||||
expectTagUpdate('TODAY', { taskIds: ['task2', 'parent-task'] }),
|
||||
expectTagUpdate('TODAY', { taskIds: ['parent-task', 'task2'] }),
|
||||
action,
|
||||
testState,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue