diff --git a/website/src/components/website/EventScenarios2.vue b/website/src/components/website/EventScenarios2.vue index c32a0c52..20a997dc 100644 --- a/website/src/components/website/EventScenarios2.vue +++ b/website/src/components/website/EventScenarios2.vue @@ -41,7 +41,7 @@ - + @@ -49,7 +49,10 @@ - @@ -105,7 +108,8 @@ export default { activeScenarioView: "all", showCountsAsPercentages: true, showOnlyPossible: true, - showOnlyIncomplete: false + showOnlyIncomplete: false, + manualScenarioFilters: [] }), computed: { blocks() { @@ -127,6 +131,12 @@ export default { if (!scenarios) return []; if (this.showOnlyIncomplete) scenarios = scenarios.filter(s => s.standings.length !== s.teams.length); if (this.showOnlyPossible) scenarios = scenarios.filter(s => !s.impossible); + + if (this.manualScenarioFilters?.length) { + scenarios = scenarios.filter(s => this.manualScenarioFilters.some(({ team, position }) => { + return s.standings[position].some(t => t.code === team); + })); + } return scenarios; }, matchGroups() { @@ -429,7 +439,7 @@ export default { // // quick default sort // scenario.teams.sort(sortFunction); - console.log("sort", i + 1, this.blocks.standingsSort); + // console.log("sort", i + 1, this.blocks.standingsSort); if (this.sortingMethods) { scenario.standings = sortTeamsIntoStandings(scenario.teams, { sort: this.sortingMethods @@ -437,7 +447,7 @@ export default { } else { scenario.standings = sortTeamsIntoStandings(scenario.teams); } - console.log(scenario.standings); + // console.log(scenario.standings); // // scenario.standings = sortIntoGroups2(sortByMapWins, [scenario.teams]); // if (i === 4050) console.log(i, scenario.standings); @@ -494,6 +504,18 @@ export default { return (x * 100).toFixed(1) + "%"; // console.log(x, this.currentScenarioView.length); } + }, + methods: { + showWhen(team, position) { + if (this.filterHas(team, position)) return this.manualScenarioFilters.splice(this.filterIndex(team, position), 1); + this.manualScenarioFilters.push({ team, position }); + }, + filterIndex(team, position) { + return this.manualScenarioFilters.findIndex((f) => f.team === team && f.position === position); + }, + filterHas(team, position) { + return this.filterIndex(team, position) !== -1; + } } }; @@ -502,4 +524,8 @@ export default { td { border-bottom: 1px solid #555; } + .cell-num { + min-width: 3em; + text-align: center; + } diff --git a/website/src/utils/scenarios.js b/website/src/utils/scenarios.js index 80f3b869..41d8bada 100644 --- a/website/src/utils/scenarios.js +++ b/website/src/utils/scenarios.js @@ -283,13 +283,13 @@ export function sortWithinGroups(sortFunction, standings) { function miniLeaguePrep(standings) { for (const group of standings) { if (group.length <= 1) continue; - console.log("minileagueprep", group); - if (group.length === 2) console.log("minileague h2h", group); + // console.log("minileagueprep", group); + // if (group.length === 2) console.log("minileague h2h", group); const groupIDs = group.map(g => g.id); group.forEach(team => { - console.log("minileague setup", team.id, groupIDs, team.standings.h2h); + // console.log("minileague setup", team.id, groupIDs, team.standings.h2h); team.standings.minileague = { wins: 0, losses: 0, @@ -307,10 +307,10 @@ function miniLeaguePrep(standings) { }); }); - console.log(group); - console.log(group.sort(miniLeagueMatchDiff).map(t => `|${t.code.padStart(6, " ")} ${t.standings.minileague.wins}-${t.standings.minileague.losses} (${t.standings.minileague.map_diff})`).join("\n")); + // console.log(group); + // console.log(group.sort(miniLeagueMatchDiff).map(t => `|${t.code.padStart(6, " ")} ${t.standings.minileague.wins}-${t.standings.minileague.losses} (${t.standings.minileague.map_diff})`).join("\n")); - if (group.length === 2) console.log("minileague h2h", standings); + // if (group.length === 2) console.log("minileague h2h", standings); /* * Set up a minileague * - Take all the head to heads from all the teams in the tied group @@ -332,12 +332,12 @@ function getSortMethod(stringMethod) { } export function sortTeamsIntoStandings(teams, settings = {}) { - const log = true; + const log = false; if (log) console.log("[standings]", "starting sort", teams, settings); if (settings.sort) { // Custom sort - console.log("[standings]", `Sorting in custom order: ${settings.sort}`); + if (log) console.log("[standings]", `Sorting in custom order: ${settings.sort}`); let standings = [teams]; for (const mode of settings.sort) { const _method = getSortMethod(mode); @@ -351,7 +351,7 @@ export function sortTeamsIntoStandings(teams, settings = {}) { } else { standings = sortIntoGroups2(method, standings); } - console.log("[standings]", `[${mode}]`, standings); + if (log) console.log("[standings]", `[${mode}]`, standings); } return standings; }
{{ showCountsAsPercentages ? `% of ${currentScenarioView.length} scenarios` : `/${currentScenarioView.length} scenarios`}}{{ showCountsAsPercentages ? `% of ${currentScenarioView.length} scenarios` : `/${currentScenarioView.length} scenarios`}} #{{ i + 1 }}
{{ team.code }} + {{ (pos / currentScenarioView.length) | perc }} {{ pos }}