Skip to content

Commit

Permalink
Corrected wrong elo shown
Browse files Browse the repository at this point in the history
  • Loading branch information
Strikeeaglechase committed Aug 22, 2024
1 parent 4ee5539 commit 316525f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/commands/elo/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class Stats extends SlashCommand {
const endOfSeasonStats = targetSeason.active ? null : await app.endOfSeasonStats.collection.findOne({ season: targetSeason.id, userId: user.id });
const rawRank = app.getUserRank(user, targetSeason, endOfSeasonStats);
const rank = rawRank == "N/A" ? 0 : rawRank;
const elo = targetSeason.active ? user.elo : endOfSeasonStats?.elo ?? 0;
const playersWithRank = targetSeason.totalRankedUsers;
const mostRecentSession = user.sessions?.length > 0 ? user.sessions[user.sessions.length - 1] : null;
const lastOnlineTimeStamp = mostRecentSession ? `<t:${Math.floor((mostRecentSession?.startTime ?? 0) / 1000)}:R>` : "Never";
Expand All @@ -140,7 +141,7 @@ class Stats extends SlashCommand {
embed.addFields([
{
name: "Metrics",
value: `ELO: ${Math.floor(user.elo)}\nRank: ${rank || "No rank"}\nTop ${((rank / playersWithRank) * 100).toFixed(0)}%\nPeak: ${Math.floor(maxElo)}`,
value: `ELO: ${Math.floor(elo)}\nRank: ${rank || "No rank"}\nTop ${((rank / playersWithRank) * 100).toFixed(0)}%\nPeak: ${Math.floor(maxElo)}`,
inline: true
},
{ name: "KDR", value: `K: ${kills.length} \nD: ${deaths.length} \nR: ${(kills.length / deaths.length).toFixed(2)}`, inline: true },
Expand Down

0 comments on commit 316525f

Please sign in to comment.