Skip to content

Commit 43ac0e0

Browse files
Made requested changes
1 parent ad8c75d commit 43ac0e0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ For more information on how this works, visit the [DIH4JDA Wiki!](https://github
7070
#### `GET` `guilds/{guild_id}/leaderboard/experience?page=1`
7171
- A paginated endpoint which responds with an ordered list of users, based on their help channel experience.
7272

73+
You can try out the API yourself on `api.javadiscord.net`!
74+
7375
# Credits
7476

7577
Inspiration we took from other communities:

src/main/java/net/javadiscord/javabot/systems/qotw/dao/QuestionPointsRepository.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ public List<QOTWAccount> sortByPoints() throws SQLException {
9696
* @throws SQLException If an error occurs.
9797
*/
9898
public List<QOTWAccount> getTopAccounts(int page, int size) throws SQLException {
99-
String sql = "SELECT * FROM qotw_points WHERE points > 0 ORDER BY points DESC LIMIT %d OFFSET %d";
100-
try (PreparedStatement stmt = con.prepareStatement(String.format(sql, size, Math.max(0, (page * size) - size)))) {
99+
try (PreparedStatement stmt = con.prepareStatement("SELECT * FROM qotw_points WHERE points > 0 ORDER BY points DESC LIMIT %d OFFSET %d")) {
100+
stmt.setInt(1, size);
101+
stmt.setInt(2, Math.max(0, (page * size) - size));
101102
ResultSet rs = stmt.executeQuery();
102103
List<QOTWAccount> accounts = new ArrayList<>(size);
103104
while (rs.next()) {

0 commit comments

Comments
 (0)