Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬇️ In Ark game logs table, only append arena rating changes when present #627

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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