fix(06): WR-01 gate all-day SQL branch on hasRrule=0 to stop duplicate occurrences
This commit is contained in:
@@ -198,8 +198,13 @@ eventsRouter.get('/', zValidator('query', eventsQuerySchema), async (c) => {
|
||||
sql`${calendarEvents.dtstartUtc} >= ${windowStartDate}`,
|
||||
sql`${calendarEvents.dtstartUtc} < ${windowEndDate}`,
|
||||
),
|
||||
// All-day events: dtstartDate falls in [start, end) — DATE comparison, no time component
|
||||
// Non-recurring all-day events: dtstartDate falls in [start, end) — DATE comparison.
|
||||
// WR-01: gate on hasRrule = 0 so a recurring all-day master whose dtstartDate
|
||||
// lands in the window is NOT also matched here (it is already carried by the
|
||||
// recurring branch above). Without this gate the master is expanded twice and
|
||||
// every occurrence is duplicated on the wire.
|
||||
and(
|
||||
sql`${calendarEvents.hasRrule} = 0`,
|
||||
sql`${calendarEvents.dtstartDate} IS NOT NULL`,
|
||||
sql`${calendarEvents.dtstartDate} >= ${start}`,
|
||||
sql`${calendarEvents.dtstartDate} < ${end}`,
|
||||
|
||||
Reference in New Issue
Block a user