Skip to content

Commit c87c536

Browse files
committed
Fix offset in monthly XP leaderboard
1 parent f33aceb commit c87c536

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/net/discordjug/javabot/systems/help/dao/HelpTransactionRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public int getNumberOfUsersWithHelpXPInLastMonth() {
134134
public List<Pair<Long, Integer>> getTotalTransactionWeightsInLastMonth(int page, int pageSize) {
135135
return jdbcTemplate.query("SELECT recipient, SUM(weight) experience FROM help_transaction WHERE created_at >= ? GROUP BY recipient ORDER BY experience DESC LIMIT ? OFFSET ?",
136136
(rs, row) -> new Pair<>(rs.getLong(1), rs.getInt(2)),
137-
LocalDateTime.now().minusDays(30), pageSize, page);
137+
LocalDateTime.now().minusDays(30), pageSize, Math.max(0, (page * pageSize) - pageSize));
138138
}
139139

140140
/**

0 commit comments

Comments
 (0)