Skip to content
Permalink
Browse files

Merge pull request #245 from lusbenjamin/colorize-event-results

Colorize event results to match deck winrates
  • Loading branch information...
Manuel-777 committed Apr 5, 2019
2 parents a198646 + 7a72720 commit ab5a1803798c35db674bab70013efe8d3d7a5fbe
Showing with 15 additions and 22 deletions.
  1. +4 −9 window_main/events.js
  2. +2 −3 window_main/history.js
  3. +1 −10 window_main/index.css
  4. +8 −0 window_main/renderer.js
@@ -201,17 +201,14 @@ function createEventRow(course) {
);

var winLossText = "0:0";
var winLossClass = "list_match_result_win";

var matchResultClass = "list_match_result";
var wlGate = course.ModuleInstanceData.WinLossGate;
if (wlGate !== undefined) {
winLossText = wlGate.CurrentWins + ":" + wlGate.CurrentLosses;
if (wlGate.MaxWins !== wlGate.CurrentWins) {
winLossClass = "list_match_result_loss";
}
}
var winLossClass = getEventWinLossClass(wlGate);

flexRight.appendChild(createDivision([winLossClass], winLossText));
flexRight.appendChild(createDivision([matchResultClass, winLossClass], winLossText));

return eventContainer;
}
@@ -344,9 +341,7 @@ function createMatchRow(match) {

// insert contents of flexRight

var resultClass = `list_match_result_${
match.player.win > match.opponent.win ? "win" : "loss"
}`;
var resultClass = "list_match_result";
flexRight.appendChild(
createDivision([resultClass], match.player.win + ":" + match.opponent.win)
);
@@ -325,9 +325,8 @@ function open_history_tab(loadMore) {

d = createDivision(
[
match.player.win > match.opponent.win
? "list_match_result_win"
: "list_match_result_loss"
"list_match_result",
match.player.win > match.opponent.win ? "green" : "red"
],
`${match.player.win}:${match.opponent.win}`
);
@@ -556,20 +556,11 @@ span.top_nav_item_text {
margin-right: 18px;
}

.list_match_result_win {
.list_match_result {
font-family: var(--main-font-name);
font-size: 20px;
line-height: 64px;
margin-right: 8px;
color: rgba(183, 200, 158, 1);
}

.list_match_result_loss {
line-height: 64px;
font-family: var(--main-font-name);
font-size: 20px;
margin-right: 8px;
color: rgba(221, 130, 99, 1);
}

.list_match_result_score {
@@ -2675,6 +2675,14 @@ function getWinrateClass(wr) {
return "white";
}

function getEventWinLossClass(wlGate) {
if (wlGate === undefined) return "white";
if (wlGate.MaxWins === wlGate.CurrentWins) return "blue";
if (wlGate.CurrentWins > wlGate.CurrentLosses) return "green";
if (wlGate.CurrentWins * 2 > wlGate.CurrentLosses) return "orange";
return "red";
}

//
function getDeckWinrate(deckid, lastEdit) {
var wins = 0;

0 comments on commit ab5a180

Please sign in to comment.
You can’t perform that action at this time.