Skip to content
Permalink
Browse files

fix explore filters

  • Loading branch information...
Manuel-777 committed Mar 31, 2019
1 parent 239d228 commit 499f5db85c4e2384375b45b209dc11ecaa870d0b
Showing with 16 additions and 1 deletion.
  1. +16 −1 window_main/explore.js
@@ -1,5 +1,6 @@
/*
globals
activeEvents,
eventsList,
rankedEvents,
getReadableEvent,
@@ -163,15 +164,21 @@ function drawFilters() {
let eventFilters = [];
if (filterType == "Events") {
eventFilters = Object.keys(eventsList)
.concat(activeEvents)
.map(ev => eventsList[ev])
.filter(
item =>
item != undefined &&
item != "New Player Experience" &&
item != "Direct Game" &&
item != "Ranked" &&
item != "Play" &&
item != "Traditional Play" &&
item != "Traditional Ranked"
item != "Traditional Ranked" &&
!rankedEvents.map(ev => eventsList[ev]).includes(item)
);

eventFilters = [...new Set(eventFilters)];
} else if (filterType == "Ranked Draft") {
eventFilters = rankedEvents.map(ev => eventsList[ev]);
} else if (filterType == "Ranked Constructed") {
@@ -185,6 +192,14 @@ function drawFilters() {
return 0;
});

let mappedActive = activeEvents.map(ev => eventsList[ev]);
eventFilters.forEach(item => {
if (mappedActive.includes(item)) {
eventFilters.splice(eventFilters.indexOf(item), 1);
eventFilters.unshift(item);
}
});

createSelect(
buttonsTop,
eventFilters,

0 comments on commit 499f5db

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