Skip to content

Commit

Permalink
⬇️ In Ark game logs table, only append arena rating changes when pres…
Browse files Browse the repository at this point in the history
…ent (#627)
  • Loading branch information
shaldengeki authored Oct 12, 2024
1 parent 8049835 commit 46833c6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ark_nova_stats/frontend/src/components/GameLogsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const GameLogsTable = ({gameLogs, currentPlayer}: GameLogsTableParams) => {
"Players": <ul>{gameLog.users.map((user: User) => {
const ratingChange = gameLog.gameRatingChanges.find((change) => { return change.user.bgaId === user.bgaId })
const priorElos = [];
let linkTextParts = [user.name];
const linkTextParts = [user.name];
if (ratingChange?.priorElo) {
priorElos.push(ratingChange.priorElo)
if (ratingChange.priorArenaElo) {
Expand All @@ -52,9 +52,12 @@ const GameLogsTable = ({gameLogs, currentPlayer}: GameLogsTableParams) => {
if (currentPlayer !== undefined) {
const ratingChange = gameLog.gameRatingChanges.find((change) => { return change.user.bgaId === currentPlayer.bgaId })
if (ratingChange) {
const ratingChanges = [`Normal: ${ratingChange.priorElo} -> ${ratingChange.newElo}`];
if (ratingChange.priorArenaElo) {
ratingChanges.push(`Arena: ${ratingChange.priorArenaElo} -> ${ratingChange.newArenaElo}`)
}
rowAttrs["Rating changes"] = <ul>
<li>Normal: {ratingChange.priorElo} -&gt; {ratingChange.newElo}</li>
<li>Arena: {ratingChange.priorArenaElo} -&gt; {ratingChange.newArenaElo}</li>
{ratingChanges.map((change) => { return <li>{change}</li>})}
</ul>;
}
}
Expand Down

0 comments on commit 46833c6

Please sign in to comment.