Skip to content

Commit

Permalink
fix sorting algorithm causing changes to account objects
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbasPL committed Aug 4, 2021
1 parent 492a09e commit fe19d4e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.1.1
- fixed sorting algorithm causing changes to account data

# 1.1.0
- added support for shared secrets ([#5](https://github.com/dumbasPL/csgo-checker/issues/5))
- added new cooldown reason `Reports (Grief)`
Expand Down
15 changes: 9 additions & 6 deletions html/js/front.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,20 +300,23 @@ function handleSort(elem, increment = true) {
//combine bans and errors
if (col_name == 'ban') {
accounts = accounts.map(a => {
a[1].ban = a[1].error ?? formatPenalty(a[1].penalty_reason ?? '?', a[1].penalty_seconds ?? -1);
return a;
let clone = Object.assign({}, a[1]);
clone.ban = clone.error ?? formatPenalty(clone.penalty_reason ?? '?', clone.penalty_seconds ?? -1);
return [a[0], clone];
});
}
if (col_name == 'rank' || col_name == 'rank_dz' || col_name == 'rank_wg') {
accounts = accounts.map(a => {
a[1][col_name] = Math.max(a[1][col_name], 0); //clap -1 to 0 so sorting works correctly
return a;
let clone = Object.assign({}, a[1]);
clone[col_name] = Math.max(clone[col_name], 0); //clap -1 to 0 so sorting works correctly
return [a[0], clone];
});
}
if (col_name == 'prime') {
accounts = accounts.map(a => {
a[1].prime = a[1].prime ? 1 : 0; //convert to integer
return a;
let clone = Object.assign({}, a[1]);
clone.prime = clone.prime ? 1 : 0; //convert to integer
return [a[0], clone];
});
}
if (new_sort_dir != 'none') {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "csgo-checker",
"version": "1.1.0",
"version": "1.1.1",
"description": "csgo-checker",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit fe19d4e

Please sign in to comment.