Skip to content
Permalink
Browse files

Merge pull request #679 from Thaoden/FixExploreEventUndefined

Fix explore event undefined (second attempt)
  • Loading branch information...
Manuel-777 committed Oct 30, 2019
2 parents 5907b09 + 34f30d4 commit 84cc6f7794fdd7aa5c8c850f8bbffa25b4e7d6c0
Showing with 20 additions and 5 deletions.
  1. +20 −5 src/window_main/explore.js
@@ -361,6 +361,16 @@ function getInputValue(id, defaultVal) {
return q[0].value;
}

function getInputValueFromButton(id, defaultVal) {
let exploreEventDiv = $$("." + id);
let exploreEventButton = exploreEventDiv[0].children[0];

if (exploreEventButton.textContent === "") {
return defaultVal;
}
return exploreEventButton.textContent;
}

//
function handleNewSearch() {
const exploreList = document.getElementById("explore_list");
@@ -369,9 +379,12 @@ function handleNewSearch() {
const ed = getLocalState().exploreData;
const exploreData = {
...ed,
filterEvent: getInputValue("explore_query_event", ed.filterEvent),
filterSort: getInputValue("explore_query_sort", ed.filterSort),
filterSortDir: getInputValue("explore_query_sortdir", ed.filterSortDir),
filterEvent: getInputValueFromButton("explore_query_event", ed.filterEvent),
filterSort: getInputValueFromButton("explore_query_sort", ed.filterSort),
filterSortDir: getInputValueFromButton(
"explore_query_sortdir",
ed.filterSortDir
),
filterWCC: getInputValue("explore_query_wc_c", ed.filterWCC),
filterWCU: getInputValue("explore_query_wc_u", ed.filterWCU),
filterWCR: getInputValue("explore_query_wc_r", ed.filterWCR),
@@ -453,7 +466,8 @@ function queryExplore() {

// initial query defaults event filter to first event (dynamic)
const filterEvent =
exploreData.filterEvent || getInputValue("explore_query_event", "Ladder");
exploreData.filterEvent ||
getInputValueFromButton("explore_query_event", "Ladder");
// map selected event display name back to event ID
let filterEventId = filterEvent;
const eventIds = db.eventIds.filter(
@@ -625,7 +639,7 @@ function deckLoad(_deck, index) {
["list_deck_record"],
`${_deck.mw}:${_deck.ml} <span class="${colClass}_bright">(${formatPercent(
deckWinrate.winrate
)})</span>`
)}`
);
if (_deck.mt >= 20) {
// sample Size is large enough to use Wald Interval
@@ -637,6 +651,7 @@ function deckLoad(_deck, index) {
roundWinrate(deckWinrate.interval)
)}</i>`;
}
d.innerHTML += `)</span>`;

flr.appendChild(d);

0 comments on commit 84cc6f7

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