Skip to content

Commit

Permalink
v1.4.3 - fixed player counter in popular ranks
Browse files Browse the repository at this point in the history
  • Loading branch information
dphdmn committed Jul 4, 2024
1 parent 1d22fa2 commit ffaed8d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<link rel="icon" href="images/egg.png" type="image/png">
<title>Better Slidysim Leaderboard v1.4.2</title>
<title>Better Slidysim Leaderboard v1.4.3</title>
</head>

<body>
Expand Down
18 changes: 17 additions & 1 deletion modules/dataProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ function filterByKeyboard(originalList) {
return originalList.filter(item => item.controls === "Keyboard");
}

//Only for single category scores list, do not try at mixed categories lists!
function filterByUnique(originalList) {
const nameFilterSet = new Set();
return originalList.filter(item => {
Expand Down Expand Up @@ -590,17 +591,32 @@ function getPopularList(scores, controlType, categoriesAmount = 1, onlySquares =
categoryCountMap.set(category, 1);
}
}
let reservedCategories = [];
function reserveCategory(name, category) {
const exists = reservedCategories.some(pair => pair.name === name && pair.category === category);
if (exists) {
return true;
} else {
reservedCategories.push({ name, category });
return false;
}
}
scores.forEach((item) => {
const category = defineCategoryString(item);
if ((item.time > 300 || item.time === -1) && (item.moves >= 2000 || item.moves === -1) && (item.width + item.height > 4)) {

if (categoryCountMap.has(category)) {
if (categoryCountMap.get(category) !== 0) {
categoryCountMap.set(category, categoryCountMap.get(category) + 1);
isReserved = reserveCategory(item.nameFilter, category);
if (!isReserved){
categoryCountMap.set(category, categoryCountMap.get(category) + 1);
}
} else {
reserveCategory(item.nameFilter, category);
initializeCategory(item, category);
}
} else {
reserveCategory(item.nameFilter, category);
initializeCategory(item, category);
}
} else {
Expand Down

0 comments on commit ffaed8d

Please sign in to comment.