Skip to content

Commit

Permalink
Fix summary for 1st run of fresh acct (#4712)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmadsen authored Aug 25, 2016
1 parent f642926 commit d7b4780
Showing 1 changed file with 9 additions and 26 deletions.
35 changes: 9 additions & 26 deletions pokemongo_bot/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ class Metrics(object):
def __init__(self, bot):
self.bot = bot
self.start_time = time.time()
self.dust = {'start': -1, 'latest': -1}
self.xp = {'start': -1, 'latest': -1}
self.distance = {'start': -1, 'latest': -1}
self.encounters = {'start': -1, 'latest': -1}
self.throws = {'start': -1, 'latest': -1}
self.captures = {'start': -1, 'latest': -1}
self.visits = {'start': -1, 'latest': -1}
self.unique_mons = {'start': -1, 'latest': -1}
self.evolutions = {'start': -1, 'latest': -1}
self.dust = {'start': 0, 'latest': 0}
self.xp = {'start': 0, 'latest': 0}
self.distance = {'start': 0, 'latest': 0}
self.encounters = {'start': 0, 'latest': 0}
self.throws = {'start': 0, 'latest': 0}
self.captures = {'start': 0, 'latest': 0}
self.visits = {'start': 0, 'latest': 0}
self.unique_mons = {'start': 0, 'latest': 0}
self.evolutions = {'start': 0, 'latest': 0}

self.releases = 0
self.highest_cp = {'cp': 0, 'desc': ''}
Expand Down Expand Up @@ -111,31 +111,14 @@ def capture_stats(self):
playerdata = item['inventory_item_data']['player_stats']

self.xp['latest'] = playerdata.get('experience', 0)
if self.xp['start'] < 0: self.xp['start'] = self.xp['latest']

self.visits['latest'] = playerdata.get('poke_stop_visits', 0)
if self.visits['start'] < 0: self.visits['start'] = self.visits['latest']

self.captures['latest'] = playerdata.get('pokemons_captured', 0)
if self.captures['start'] < 0: self.captures['start'] = self.captures['latest']

self.distance['latest'] = playerdata.get('km_walked', 0)
if self.distance['start'] < 0: self.distance['start'] = self.distance['latest']

self.encounters['latest'] = playerdata.get('pokemons_encountered', 0)
if self.encounters['start'] < 0: self.encounters['start'] = self.encounters['latest']

self.throws['latest'] = playerdata.get('pokeballs_thrown', 0)
if self.throws['start'] < 0: self.throws['start'] = self.throws['latest']

self.unique_mons['latest'] = playerdata.get('unique_pokedex_entries', 0)
if self.unique_mons['start'] < 0: self.unique_mons['start'] = self.unique_mons['latest']

self.visits['latest'] = playerdata.get('poke_stop_visits', 0)
if self.visits['start'] < 0: self.visits['start'] = self.visits['latest']

self.evolutions['latest'] = playerdata.get('evolutions', 0)
if self.evolutions['start'] < 0: self.evolutions['start'] = self.evolutions['latest']
elif 'pokedex_entry' in item['inventory_item_data']:
entry = item['inventory_item_data']['pokedex_entry'].get('pokemon_id')
if entry: uniq_pokemon_list.add(entry)
Expand Down

0 comments on commit d7b4780

Please sign in to comment.