Permalink
Browse files

Explore showing old data

M19 not filtering correctly
  • Loading branch information...
Manuel-777 committed Sep 15, 2018
1 parent 12794d8 commit 4a0d5fe7c3dde2f1bc4e972c11ac78727f023499
Showing with 35 additions and 10 deletions.
  1. +1 −1 package.json
  2. +9 −5 shared/util.js
  3. +1 −0 window_background/background.js
  4. +24 −4 window_main/renderer.js
@@ -3,7 +3,7 @@
"description": "An MTG Arena deck tracker and statistics manager.",
"author": "Manuel-777",
"repository": "https://github.com/Manuel-777/MTG-Arena-Tool",
"version": "2.1.1",
"version": "2.1.2",
"main": "main.js",
"build": {
"appId": "com.github.manuel777.mtgatool",
@@ -239,12 +239,16 @@ function getReadableEvent(arg) {
return "Pauper"; break;
case "TwiceTheLife_":
return "Twice the Life"; break;
case "QuickDraftExploration_M_":
return "Quick Draft Exploration M19"; break;
case "CompDraft_DOM_":
return "Competitive Draft DOM"; break;
case "CompDraft_M19_":
case "CompDraft_M_":
return "Competitive Draft M19"; break;
case "QuickDraft_RIX_":
return "Quick Draft RIX"; break;
case "QuickDraft_AKH_":
return "Quick Draft AKH"; break;
case "QuickDraft_DOM_":
@@ -910,8 +914,8 @@ function get_frame_class(frame) {
}
//
function timeSince(date) {
var seconds = Math.floor((new Date() - date) / 1000);
function timeSince(_date) {
var seconds = Math.floor((new Date() - _date) / 1000);
var interval = Math.floor(seconds / 31536000);
if (interval == 1)
@@ -942,9 +946,9 @@ function timeSince(date) {
}
//
function daysPast(date) {
function daysPast(_date) {
var firstDate = new Date();
var secondDate = new Date(date);
var secondDate = new Date(_date);
return Math.round(Math.abs((firstDate.getTime() - secondDate.getTime())/(24*60*60*1000)));
}
@@ -250,6 +250,7 @@ ipc.on('request_explore', function (event, arg) {
if (arg == "all" || arg == "All" ) {
arg = "";
}
arg = arg.replace("_m_", "_m19_");// dirty hack :()
httpGetTopDecks(arg);
});
@@ -916,12 +916,23 @@ function setExplore(arg, loadMore) {
if (eventFilters == null) {
eventFilters = [];
eventFilters.push('All');
var dateNow = new Date();
dateNow = dateNow.getTime()/1000;
for (var i = 0; i < explore.length; i++) {
let _deck = explore[i];
let evId = _deck.event.replace(/[0-9]/g, '');
var _deck = explore[i];
if (!eventFilters.includes(evId)) {
eventFilters.push(evId);
var ss = Math.floor(dateNow - _deck.date);
if (Math.floor(ss / 86400) > 10) {
explore.splice(i, 1);
i--;
}
else {
let evId = _deck.event.replace(/[0-9]/g, '');
if (!eventFilters.includes(evId)) {
eventFilters.push(evId);
}
}
}
}
@@ -956,8 +967,17 @@ function setExplore(arg, loadMore) {
//explore.forEach(function(_deck, index) {
for (var loadEnd = loadExplore + loadMore; loadExplore < loadEnd; loadExplore++) {
let _deck = explore[loadExplore];
if (_deck == undefined) {
continue;
}
let index = loadExplore;
var dateNow = new Date();
dateNow = dateNow.getTime()/1000;
var ss = Math.floor(dateNow - _deck.date);
if (Math.floor(ss / 86400) > 10) {
continue;
}
if (_deck.deck_colors == undefined) {
_deck.deck_colors = [];

0 comments on commit 4a0d5fe

Please sign in to comment.