Skip to content

Commit

Permalink
Merge pull request #41 from rarimo/fix/leaderboard-pagination
Browse files Browse the repository at this point in the history
Fix leaderboard pagination applied to wrong builder
  • Loading branch information
violog authored Jul 3, 2024
2 parents 1a2f3ef + 9800fac commit a61454a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/data/pg/balances.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit a61454a

Please sign in to comment.