Skip to content

Commit

Permalink
Fix time display edge case, ignore bug
Browse files Browse the repository at this point in the history
userA last seen 28 minutes ago
userB last seen 65 days, 44 minutes ago

Hours was missing with userB, among other things. Had something to do with 0 hours while there were days.
  • Loading branch information
besser435 committed Nov 18, 2023
1 parent 0a77fa7 commit 9e3e2ff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions website/static/js/players.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function formatLastOnline(lastOnlineTimestamp) {
formattedTime += `${days} day${days > 1 ? "s" : ""}, `;
}

if (hours > 0) {
formattedTime += `${hours} hour${hours > 1 ? "s" : ""}, `;
if (hours > 0 || days > 0) {
formattedTime += `${hours} hour${hours !== 1 ? "s" : ""}, `;
}

if (timeDiff < 15_000) { // effectively minutes. Must be the same as the interval in updatePlayerInfo()
Expand Down Expand Up @@ -141,7 +141,8 @@ document.addEventListener("DOMContentLoaded", function () {
});

// Display "No players found" message if no users are found
const noUsersFoundMessage = document.getElementById("no-users-found");
const noUsersFoundMessage = document.getElementById("no-users-found"); // BUG uncaught TypeError: Cannot read properties of null
// Something to do with loading the user data where its created, since the error count varies.
if (!usersFound) {
noUsersFoundMessage.style.display = "block";
} else {
Expand Down

0 comments on commit 9e3e2ff

Please sign in to comment.