1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

fix: improve pagination when having identical publication date

This commit is contained in:
Frédéric Guillot 2025-01-18 16:49:08 -08:00
parent 9c82e55b98
commit 400e8974f9
10 changed files with 12 additions and 3 deletions

View file

@ -112,13 +112,13 @@ func (e *EntryPaginationBuilder) getPrevNextID(tx *sql.Tx) (prevID int64, nextID
WITH entry_pagination AS (
SELECT
e.id,
lag(e.id) over (order by e.%[1]s asc, e.id desc) as prev_id,
lead(e.id) over (order by e.%[1]s asc, e.id desc) as next_id
lag(e.id) over (order by e.%[1]s asc, e.created_at asc, e.id desc) as prev_id,
lead(e.id) over (order by e.%[1]s asc, e.created_at asc, e.id desc) as next_id
FROM entries AS e
JOIN feeds AS f ON f.id=e.feed_id
JOIN categories c ON c.id = f.category_id
WHERE %[2]s
ORDER BY e.%[1]s asc, e.id desc
ORDER BY e.%[1]s asc, e.created_at asc, e.id desc
)
SELECT prev_id, next_id FROM entry_pagination AS ep WHERE %[3]s;
`