Skip to content

Commit fe19d4e

Browse files
committed
fix sorting algorithm causing changes to account objects
1 parent 492a09e commit fe19d4e

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.1.1
2+
- fixed sorting algorithm causing changes to account data
3+
14
# 1.1.0
25
- added support for shared secrets ([#5](https://github.com/dumbasPL/csgo-checker/issues/5))
36
- added new cooldown reason `Reports (Grief)`

html/js/front.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,20 +300,23 @@ function handleSort(elem, increment = true) {
300300
//combine bans and errors
301301
if (col_name == 'ban') {
302302
accounts = accounts.map(a => {
303-
a[1].ban = a[1].error ?? formatPenalty(a[1].penalty_reason ?? '?', a[1].penalty_seconds ?? -1);
304-
return a;
303+
let clone = Object.assign({}, a[1]);
304+
clone.ban = clone.error ?? formatPenalty(clone.penalty_reason ?? '?', clone.penalty_seconds ?? -1);
305+
return [a[0], clone];
305306
});
306307
}
307308
if (col_name == 'rank' || col_name == 'rank_dz' || col_name == 'rank_wg') {
308309
accounts = accounts.map(a => {
309-
a[1][col_name] = Math.max(a[1][col_name], 0); //clap -1 to 0 so sorting works correctly
310-
return a;
310+
let clone = Object.assign({}, a[1]);
311+
clone[col_name] = Math.max(clone[col_name], 0); //clap -1 to 0 so sorting works correctly
312+
return [a[0], clone];
311313
});
312314
}
313315
if (col_name == 'prime') {
314316
accounts = accounts.map(a => {
315-
a[1].prime = a[1].prime ? 1 : 0; //convert to integer
316-
return a;
317+
let clone = Object.assign({}, a[1]);
318+
clone.prime = clone.prime ? 1 : 0; //convert to integer
319+
return [a[0], clone];
317320
});
318321
}
319322
if (new_sort_dir != 'none') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "csgo-checker",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "csgo-checker",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)