@@ -94,7 +94,7 @@ async function fetchTodayPlanTasks(visibleTasksWhere) {
9494 'cancelled' ,
9595 ] ;
9696
97- return await Task . findAll ( {
97+ const tasks = await Task . findAll ( {
9898 where : {
9999 [ Op . and ] : [
100100 visibleTasksWhere ,
@@ -112,7 +112,7 @@ async function fetchTodayPlanTasks(visibleTasksWhere) {
112112 { defer_until : { [ Op . lte ] : now } } ,
113113 ] ,
114114 } ,
115- // Exclude recurring parent tasks - only include non- recurring tasks or recurring instances
115+ // Include non- recurring tasks, recurring parents, and recurring instances
116116 {
117117 [ Op . or ] : [
118118 {
@@ -122,11 +122,21 @@ async function fetchTodayPlanTasks(visibleTasksWhere) {
122122 [ Op . or ] : [
123123 { recurrence_type : 'none' } ,
124124 { recurrence_type : null } ,
125+ { recurrence_type : '' } ,
125126 ] ,
126127 } ,
127128 { recurring_parent_id : null } ,
128129 ] ,
129130 } ,
131+ {
132+ // Recurring parent tasks
133+ [ Op . and ] : [
134+ { recurrence_type : { [ Op . ne ] : 'none' } } ,
135+ { recurrence_type : { [ Op . ne ] : null } } ,
136+ { recurrence_type : { [ Op . ne ] : '' } } ,
137+ { recurring_parent_id : null } ,
138+ ] ,
139+ } ,
130140 {
131141 // Recurring instances (not parents)
132142 recurring_parent_id : { [ Op . ne ] : null } ,
@@ -142,6 +152,18 @@ async function fetchTodayPlanTasks(visibleTasksWhere) {
142152 [ 'project_id' , 'ASC' ] ,
143153 ] ,
144154 } ) ;
155+
156+ // Deduplicate: exclude recurring parents that already have instances in the list
157+ const parentIdsWithInstances = new Set (
158+ tasks
159+ . filter ( ( t ) => t . recurring_parent_id )
160+ . map ( ( t ) => t . recurring_parent_id )
161+ ) ;
162+
163+ return tasks . filter (
164+ ( t ) =>
165+ ! parentIdsWithInstances . has ( t . id ) || t . recurring_parent_id !== null
166+ ) ;
145167}
146168
147169async function fetchTasksDueToday ( visibleTasksWhere , userTimezone ) {
0 commit comments