From 0216709e47052a068acd4814644d4826232b039c Mon Sep 17 00:00:00 2001 From: wraythex <59678213+wraythex@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:25:53 -0500 Subject: [PATCH 1/2] Add detailed invasion stats in the sidebar (async) --- static/js/map/map.stats.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/static/js/map/map.stats.js b/static/js/map/map.stats.js index e6a265788..81cf6dbd2 100644 --- a/static/js/map/map.stats.js +++ b/static/js/map/map.stats.js @@ -429,7 +429,7 @@ function updateStatsTable() { if (selectedTab === '#pokestop-stats-tab') { let noStatusCount = 0 let questCount = 0 - let invasionCount = 0 + let invasionCounts = {} let normalLureCount = 0 let glacialLureCount = 0 let magneticLureCount = 0 @@ -448,7 +448,15 @@ function updateStatsTable() { hasStatus = true } if (isPokestopMeetsInvasionFilters(pokestop)) { - invasionCount++ + if ( !(pokestop.incident_grunt_type in invasionCounts) ) { + let invDesc = 'Unknown Invasion' + if (pokestop.incident_grunt_type != 0) { + invDesc = `${getInvasionType(pokestop.incident_grunt_type)} ${getInvasionGrunt(pokestop.incident_grunt_type)}` + } + invasionCounts[pokestop.incident_grunt_type] = [1, getPokestopIconUrl(pokestop), invDesc] + } else { + invasionCounts[pokestop.incident_grunt_type][0] += 1 + } hasStatus = true } if (isPokestopMeetsLureFilters(pokestop)) { @@ -501,13 +509,13 @@ function updateStatsTable() { ] ) } - if (invasionCount > 0) { + for (invNum in invasionCounts) { pokestopRows.push( [ - '', - i18n('Rocket Invasion'), - invasionCount, - (invasionCount * 100) / pokestopCount + ``, + i18n(invasionCounts[invNum][2]), + invasionCounts[invNum][0], + (invasionCounts[invNum][0] * 100) / pokestopCount ] ) } From bf98196c48a0c42719303ed76884917433c8a164 Mon Sep 17 00:00:00 2001 From: wraythex <59678213+wraythex@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:40:04 -0500 Subject: [PATCH 2/2] Update map.stats.js --- static/js/map/map.stats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/map/map.stats.js b/static/js/map/map.stats.js index 81cf6dbd2..00c9b37c3 100644 --- a/static/js/map/map.stats.js +++ b/static/js/map/map.stats.js @@ -509,7 +509,7 @@ function updateStatsTable() { ] ) } - for (invNum in invasionCounts) { + for (let invNum in invasionCounts) { pokestopRows.push( [ ``,