Skip to content

Commit

Permalink
fixed displaying +/- days multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
ge-ku committed May 31, 2018
1 parent fb7fa57 commit a884644
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions gcpd730.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,26 @@ const checkBans = (players) => {
banStats.vacBans++;
}
if (player.NumberOfGameBans > 0) {
if (verdict) verdict += ' & ';
if (verdict) verdict += ' &\n';
verdict += 'Game';
banStats.gameBans++;
}
if (verdict && daySinceLastMatch > player.DaysSinceLastBan) banStats.recentBans++;
if (verdict) {
const daysAfter = daySinceLastMatch - player.DaysSinceLastBan;
if (daySinceLastMatch > player.DaysSinceLastBan) {
banStats.recentBans++;
verdict += '+' + daysAfter;
} else {
verdict += daysAfter;
}
}
playerEls.forEach(playerEl => {
playerEl.classList.add('banchecker-checked');
verdictEl = playerEl.querySelector('.banchecker-bans');
if (verdict) {
let daysAfter = daySinceLastMatch - player.DaysSinceLastBan;
if (daySinceLastMatch > player.DaysSinceLastBan) {
verdict += '+' + (daysAfter);
verdictEl.style.color = 'red';
} else {
verdict += '-' + (Math.abs(daysAfter));
verdictEl.style.color = 'grey';
}
verdictEl.style.cursor = 'help';
Expand Down Expand Up @@ -324,6 +329,7 @@ const checkLoadedMatchesForBans = () => {
if (i === 0) {
const bansHeader = document.createElement('th');
bansHeader.textContent = 'Bans';
bansHeader.style.minWidth = '5.6em';
tr.appendChild(bansHeader);
} else if (tr.childElementCount > 3) {
const bansPlaceholder = document.createElement('td');
Expand Down

0 comments on commit a884644

Please sign in to comment.