Skip to content

Commit

Permalink
Fix sorting with thousands separators in value (#3162)
Browse files Browse the repository at this point in the history
  • Loading branch information
Derkades committed Jan 10, 2023
1 parent 61c9c51 commit 5692494
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/classes/Misc/Placeholders.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function getLeaderboardData(int $server_id, string $placeholder_name): ar
$sort = $this->getPlaceholder($server_id, sha1($placeholder_name))->leaderboard_sort;

// We have to add 0 to value so mysql converts from the TEXT field to an integer value
$leaderboard_data = $this->_db->query("SELECT * FROM nl2_users_placeholders WHERE name = ? AND server_id = ? ORDER BY value + 0 {$sort} LIMIT 50", [$placeholder_name, $server_id]);
$leaderboard_data = $this->_db->query("SELECT * FROM nl2_users_placeholders WHERE name = ? AND server_id = ? ORDER BY REPLACE(value, ',', '') + 0 {$sort} LIMIT 50", [$placeholder_name, $server_id]);

if (!$leaderboard_data->count()) {
return [];
Expand Down

0 comments on commit 5692494

Please sign in to comment.