Get GEO code for all visits (not only valid ones)

This commit is contained in:
Gregory Soutade 2017-09-06 07:43:55 +02:00
parent dadd0c9029
commit 8255be7ec8
2 changed files with 5 additions and 5 deletions

View File

@ -69,10 +69,10 @@ class IWLADisplayTopGeo(IPlugin):
def FlagFilter(host, self):
cc = None
host_name = host.split(' ')[0] # hostname or ip
if host_name in self.valid_visitors.keys():
cc = self.valid_visitors[host_name].get('country_code', None)
if host_name in self.visitors.keys():
cc = self.visitors[host_name].get('country_code', None)
else:
for visitor in self.valid_visitors.values():
for visitor in self.visitors.values():
if visitor['remote_addr'] == host_name:
cc = visitor.get('country_code', None)
break
@ -84,7 +84,7 @@ class IWLADisplayTopGeo(IPlugin):
display = self.iwla.getDisplay()
geo = self.iwla.getMonthStats().get('geo', {})
geo = sorted(geo.items(), key=lambda t: t[1], reverse=True)
self.valid_visitors = self.iwla.getValidVisitors()
self.visitors = self.iwla.getCurrentVisits()
# All in a page
if self.create_geo_page:

View File

@ -71,7 +71,7 @@ class IWLAPostAnalysisIPToGeo(IPlugin):
return True
def hook(self):
visitors = self.iwla.getValidVisitors()
visitors = self.iwla.getCurrentVisits()
month_stats = self.iwla.getMonthStats()
geo = month_stats.get('geo', {})