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

Fix player-stats-experience for players that have not played yet with their current team #1715

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
13 changes: 11 additions & 2 deletions content/information-aggregation/player-stats-experience.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,17 @@ Foxtrick.modules.PlayerStatsExperience = {
thXP.title = Foxtrick.L10n.getString('PlayerStatsExperience.ExperienceChange.title');

var store = module.store;
var [header, bestPerf, ...statsRows] = [...statsTable.rows];

// Brand new players have no stats table at all
// Players that have not played yet with their current team do not have a best performance line (label + actual performance)
if (statsTable.rows[1].id != "") {
var [header, ...statsRows] = [...statsTable.rows];
} else {
var [header, bestPerf, ...statsRows] = [...statsTable.rows];
bestPerf.cells[0].colSpan += 1;
}

header.insertBefore(thXP, header.cells[8]);
bestPerf.cells[0].colSpan += 1;

// sum up xp stuff
for (let row of statsRows) {
Expand All @@ -372,6 +380,7 @@ Foxtrick.modules.PlayerStatsExperience = {

// current skilllevel
let xpNow = parseInt(row.cells[module.XP_CELL_IDX].textContent, 10);
// Best performance line appears in statsRows, but does not display any XP information
if (Number.isNaN(xpNow))
continue;

Expand Down