Permalink
Browse files

color code winrates

  • Loading branch information...
Manuel-777 committed Dec 26, 2018
1 parent f96a658 commit cfdb22d7a70caa72f58b6469cfc738003af71b84
Showing with 25 additions and 6 deletions.
  1. +2 −2 window_main/deck_details.js
  2. +19 −4 window_main/decks.js
  3. +4 −0 window_main/index.css
@@ -100,9 +100,9 @@ function deckWinrateCurve(deck) {

let curve = $('<div class="mana_curve"></div>');
let numbers = $('<div class="mana_curve_costs"></div>');

colorsWinrates.forEach(cwr => {
if (cwr.wins + cwr.losses > 2) {
if (cwr.wins + cwr.losses > 1) {
curve.append($(`<div class="mana_curve_column back_green" style="height: ${(cwr.wins/curveMax*100)}%"></div>`));
curve.append($(`<div class="mana_curve_column back_red" style="height: ${(cwr.losses/curveMax*100)}%"></div>`));

@@ -188,17 +188,27 @@ function open_decks_tab() {
});

var wr = getDeckWinrate(deck.id, deck.lastUpdated);

if (wr != 0) {
var d = document.createElement("div");
d.classList.add('list_deck_winrate');
//d.innerHTML = 'Winrate: '+(wr.total*100).toFixed(2)+'%';
d.innerHTML = 'Wins: '+wr.wins+' / Losses: '+wr.losses+' ('+(wr.total*100).toFixed(2)+'%)';

let colClass = 'white';
if (wr.total < 0.4) colClass = 'red';
if (wr.total > 0.55) colClass = 'green';
if (wr.total > 0.65) colClass = 'blue';
d.innerHTML = `'Wins: ${wr.wins} / Losses: ${wr.losses} <span class="${colClass}">(${(wr.total*100).toFixed(2)}%)</span>`;
flr.appendChild(d);

d = document.createElement("div");
d.classList.add('list_deck_winrate');
d.style.opacity = 0.6;
d.innerHTML = 'Since last edit: '+(wr.lastEdit*100).toFixed(2)+'%';

colClass = 'white';
if (wr.lastEdit < 0.4) colClass = 'red';
if (wr.lastEdit > 0.55) colClass = 'green';
if (wr.lastEdit > 0.65) colClass = 'blue';
d.innerHTML = `Since last edit: <span class="${colClass}">${(wr.lastEdit*100).toFixed(2)}%</span>`;
flr.appendChild(d);

wrTotalWins += wr.wins;
@@ -252,7 +262,12 @@ function open_decks_tab() {
d = document.createElement("div");
d.classList.add('list_deck_winrate');
wrTotal = 1 / wrTotal * wrTotalWins;
d.innerHTML = 'Wins: '+wrTotalWins+' / Losses: '+wrTotalLosses+' ('+(wrTotal*100).toFixed(2)+'%)';

let colClass = 'white';
if (wrTotal < 0.4) colClass = 'red';
if (wrTotal > 0.55) colClass = 'green';
if (wrTotal > 0.65) colClass = 'blue';
d.innerHTML = `'Wins: ${wrTotalWins} / Losses: ${wrTotalLosses} (<span class="${colClass}">${(wrTotal*100).toFixed(2)}%</span>)`;
dtwr.appendChild(d);

$("#ux_0").append('<div class="list_fill"></div>');
@@ -536,6 +536,10 @@ span i {
color: rgba(183, 200, 158, 1) !important;
}

.blue {
color: rgba(170, 190, 223, 1) !important;
}

.red {
color: rgba(221, 130, 99, 1) !important;
}

0 comments on commit cfdb22d

Please sign in to comment.