fix: pagination bug #296

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-03-03 12:53:11 +01:00
parent 38965387da
commit 7f85b2ac0a

View File

@@ -477,7 +477,7 @@ export async function getEventList(options: GetEventListOptions) {
sb.where.cursor = `created_at < ${sqlstring.escape(formatClickhouseDate(cursor))}`; sb.where.cursor = `created_at < ${sqlstring.escape(formatClickhouseDate(cursor))}`;
} }
if (!cursor) { if (!cursor && !(startDate && endDate)) {
sb.where.cursorWindow = `created_at >= toDateTime64(${sqlstring.escape(formatClickhouseDate(new Date()))}, 3) - INTERVAL ${safeDateIntervalInDays} DAY`; sb.where.cursorWindow = `created_at >= toDateTime64(${sqlstring.escape(formatClickhouseDate(new Date()))}, 3) - INTERVAL ${safeDateIntervalInDays} DAY`;
} }
@@ -628,7 +628,7 @@ export async function getEventList(options: GetEventListOptions) {
} }
} }
sb.orderBy.created_at = 'created_at DESC'; sb.orderBy.created_at = 'created_at DESC, id ASC';
if (custom) { if (custom) {
custom(sb); custom(sb);