Skip to content

Commit

Permalink
Tested filters. Seem to work
Browse files Browse the repository at this point in the history
  • Loading branch information
hcaseyal committed Nov 27, 2017
1 parent 0189d5e commit ce23d97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var matchDetailsPerGame;
var matchesData;
var championData;

var filterStates = {"side": "both"};
var filterStates = {"side": "both", "outcome": "both"};

// Domain for the current Summoner's Rift on the in-game mini-map
var domain = {
Expand Down Expand Up @@ -225,9 +225,11 @@ function filterByRoles(datum, roles, participantId) {

function filterGenericEvents(datum, champions, roles) {
let myId = getMatchDetails(datum).myParticipantId;
return filterByChampions(d, championSelected, myId) && filterByTime(d)
&& filterBySide(d) && filterByRoles(d, roles, myId)
&& filterByOutcome(d);
return filterByChampions(datum, champions, myId) &&
filterByTime(datum) &&
filterBySide(datum) &&
filterByRoles(datum, roles, myId) &&
filterByOutcome(datum);
}

function filterByAssisters(datum, champions, roles) {
Expand Down Expand Up @@ -286,7 +288,7 @@ function updateMap() {
let filteredKills = matchesData.kills.filter(d =>
filterGenericEvents(d, championsSelf, rolesSelf)
&& filterByAssisters(d, allyChampions, allyRoles)
&& filterByVictim(enemyChampions, enemyRoles));
&& filterByVictim(d, enemyChampions, enemyRoles));

let filteredDeaths = matchesData.deaths.filter(d =>
filterGenericEvents(d, championsSelf, rolesSelf)
Expand Down Expand Up @@ -340,11 +342,11 @@ function filterByTime(datum) {

function filterByChampions(datum, champions, participantId) {
let details = getMatchDetails(datum);
if (championSelected[0] === "All champions") {
if (champions[0] === "All champions") {
return true;
}
else {
let championPlayed = details.participantDetails[particpantId].championId;
let championPlayed = details.participantDetails[participantId].championId;
for (let i in champions) {
if(championData[champions[i]].id === championPlayed) {
return true;
Expand Down Expand Up @@ -534,7 +536,7 @@ function displayAnalysis(filteredKills, filteredDeaths, filteredAssists) {
let takedownAllyChamps = toSortedArray(takedowns.participatingAllyChampions);
let takedownAllyRoles = toSortedArray(takedowns.participatingAllyRoles);
let takedownVictimChamps = toSortedArray(takedowns.victimChampions);
let takedownVictimRoles = toSortedArray(takedown.victimRoles);
let takedownVictimRoles = toSortedArray(takedowns.victimRoles);

let deathsEnemyChamps = toSortedArray(deaths.enemyChampions);
let deathsEnemyRoles = toSortedArray(deaths.enemyRoles);
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let fs = require('fs');

const port = 8081;
let baseURL = 'https://na1.api.riotgames.com/lol/';
let apiKey = 'RGAPI-09b1543a-84f9-45ea-a26d-7e41cc858864';
let apiKey = 'RGAPI-e7e5b3c4-a8fc-4ef3-8570-ddd484b0dee0';

const queues = {2: "5v5 Blind Pick",
4: "5v5 Ranked Solo",
Expand Down

0 comments on commit ce23d97

Please sign in to comment.