From eba40a4eeeaf0ecb68f5b9e6b56101fc1a23993f Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sat, 16 Apr 2022 23:56:06 +0200 Subject: [PATCH] Problem: before pagination shows first items Solution: use greater than to filter first item --- pkg/timeline/postgres.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/timeline/postgres.go b/pkg/timeline/postgres.go index 95f8455..b5e98ee 100644 --- a/pkg/timeline/postgres.go +++ b/pkg/timeline/postgres.go @@ -127,7 +127,7 @@ WHERE "channel_id" = $1 log.Println(err) } else { args = append(args, b) - qb.WriteString(` AND "published_at" >= $2`) + qb.WriteString(` AND "published_at" > $2`) } } else if after != "" { b, err := time.Parse(time.RFC3339, after) @@ -196,7 +196,7 @@ WHERE "channel_id" = $1 } func hasMoreBefore(conn *sql.Conn, before string) bool { - row := conn.QueryRowContext(context.Background(), `SELECT COUNT(*) FROM "items" WHERE "published_at" >= $1`, before) + row := conn.QueryRowContext(context.Background(), `SELECT COUNT(*) FROM "items" WHERE "published_at" > $1`, before) var count int if err := row.Scan(&count); err == sql.ErrNoRows { return false