Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
Adjust comments + disable filtering players that didn't load but stil…
Browse files Browse the repository at this point in the history
…l did
  • Loading branch information
robflop committed May 30, 2018
1 parent 0bfa1b0 commit fde44f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"name": "Electron: Renderer process",
"port": 9223,
"webRoot": "${workspaceFolder}",
"timeout": 30000,
"timeout": 10000,
}
],
"compounds": [
Expand Down
14 changes: 10 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ const app = new Vue({
.sort((a, b) => a.piIndex - b.piIndex)
.map(player => player.leftGameReason === 'Reconnected' ? player.pConInt = 4 : null);
// sort by piIndex and adjust connection status for reconnection
this.parsedMatchInfo = this.parsedMatchInfo.filter(player => player.piIndex !== -1);
// filter out players that didn't load into the game (piIndex === -1)

// this.parsedMatchInfo = this.parsedMatchInfo.filter(player => player.piIndex !== -1);
// ABOVE DISABLED BECAUSE BROKEN; filter out players that didn't load into the game (piIndex === -1)
this.parsedMatchInfo.map(player => { // eslint-disable-line array-callback-return
player.lastJournalLeft = player.lastJournalLeft.split('\n').filter(line => line).map(line => line.trim());
player.lastJournalRight = player.lastJournalRight.split('\n').filter(line => line).map(line => line.trim());
});
this.parsedChatLogs = this.chatLogsInput.split('[,]').filter(line => line).map(line => line.trim());
// this character sequence is the line seperator in raw report logs
// parse chatlogs (character sequence is line seperator) and assign it as base chatlogs "backup" to work with
this.savedChatLogs = this.parsedChatLogs;
this.days = this.savedChatLogs.filter(line => /\(Day\) Day \d+/.test(line)).length;
this.nights = this.savedChatLogs.filter(line => /\(Day\) Night \d+/.test(line)).length;
Expand Down Expand Up @@ -186,7 +187,12 @@ const app = new Vue({

if (this.filteredPlayers.length) {
chatLogs = chatLogs.filter(line => {
return this.filteredPlayers.some(player => line.includes(player) || line.startsWith('(Day)') || line.startsWith('(Win)'));
let hit = false;

if (this.filteredPlayers.some(player => line.includes(player))) hit = true;
if (line.startsWith('(Day)') || line.startsWith('(Win)')) hit = true;

return hit;
});
}

Expand Down

0 comments on commit fde44f1

Please sign in to comment.