From 9800fac22165a91920cca8b2d2b0e392170d3e7f Mon Sep 17 00:00:00 2001 From: violog <51th.apprent1ce.f0rce@gmail.com> Date: Wed, 3 Jul 2024 13:30:39 +0300 Subject: [PATCH] Fix leaderboard pagination applied to wrong builder --- internal/data/pg/balances.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/data/pg/balances.go b/internal/data/pg/balances.go index 7819a47..479969c 100644 --- a/internal/data/pg/balances.go +++ b/internal/data/pg/balances.go @@ -56,7 +56,7 @@ func (q *balances) Update(fields map[string]any) error { return nil } -// ApplyRankedPage is similar to the ApplyTo method for a page, +// applyRankedPage is similar to the pgdb.OffsetParams.ApplyTo method, // but the sorting values are hardcoded because the fields must // be sorted in opposite directions func applyRankedPage(page *pgdb.OffsetPageParams, sql squirrel.SelectBuilder) squirrel.SelectBuilder { @@ -87,6 +87,7 @@ func applyRankedPage(page *pgdb.OffsetPageParams, sql squirrel.SelectBuilder) sq func (q *balances) Page(page *pgdb.OffsetPageParams) data.BalancesQ { q.selector = applyRankedPage(page, q.selector) + q.rank = applyRankedPage(page, q.rank) return q }