mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-25 02:59:53 +01:00
stat_worker(): fix bug introduced in earlier commit
This commit is contained in:
1 parent
829e03f644
commit
f4f153a175
1 file changed
+3
-7
@@ -1933,23 +1933,19 @@ async def stat_worker(queue : asyncio.Queue, workerID: int, args : argparse.Name
|
|||||||
try:
|
try:
|
||||||
bu.debug('Stat_id: ' + stat_id, id=workerID)
|
bu.debug('Stat_id: ' + stat_id, id=workerID)
|
||||||
bu.print_progress()
|
bu.print_progress()
|
||||||
# Analysing player performance based on their stats on the tier tanks they are playing
|
stats_tmp = None
|
||||||
|
|
||||||
# Try cache first
|
# Try cache first
|
||||||
if (stat_id not in stats):
|
|
||||||
stats_tmp = None
|
|
||||||
pruned_stat_id = prune_stat_id(stat_id)
|
pruned_stat_id = prune_stat_id(stat_id)
|
||||||
if (pruned_stat_id not in stats):
|
if (pruned_stat_id not in stats):
|
||||||
stats_tmp = await stat_wg_func(pruned_stat_id, cache_only = True)
|
stats_tmp = await stat_wg_func(pruned_stat_id, cache_only = True)
|
||||||
else:
|
else:
|
||||||
stat_id_remap[stat_id] = pruned_stat_id
|
stat_id_remap[stat_id] = pruned_stat_id
|
||||||
queue.task_done()
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (stats_tmp != None):
|
if (stats_tmp != None):
|
||||||
stats[pruned_stat_id] = stats_tmp
|
stats[pruned_stat_id] = stats_tmp
|
||||||
stat_id_remap[stat_id] = pruned_stat_id
|
stat_id_remap[stat_id] = pruned_stat_id
|
||||||
queue.task_done()
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# try DB
|
# try DB
|
||||||
@@ -1963,11 +1959,11 @@ async def stat_worker(queue : asyncio.Queue, workerID: int, args : argparse.Name
|
|||||||
del stats[stat_id]
|
del stats[stat_id]
|
||||||
bu.debug('get_wg_' + args.stat_func + '_stats returned: account_id=' + str(get_account_id_f_stat_id(pruned_stat_id)) + ': ' + str(stats[pruned_stat_id]), workerID)
|
bu.debug('get_wg_' + args.stat_func + '_stats returned: account_id=' + str(get_account_id_f_stat_id(pruned_stat_id)) + ': ' + str(stats[pruned_stat_id]), workerID)
|
||||||
|
|
||||||
|
|
||||||
except KeyError as err:
|
except KeyError as err:
|
||||||
bu.error('Key not found', err, id=workerID)
|
bu.error('Key not found', err, id=workerID)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
bu.error('Unexpected error', err, id=workerID)
|
bu.error('Unexpected error', err, id=workerID)
|
||||||
|
finally:
|
||||||
queue.task_done()
|
queue.task_done()
|
||||||
|
|
||||||
except (asyncio.CancelledError, concurrent.futures.CancelledError):
|
except (asyncio.CancelledError, concurrent.futures.CancelledError):
|
||||||
@@ -2028,7 +2024,7 @@ async def get_db_tank_stats(db : motor.motor_asyncio.AsyncIOMotorDatabase, stat_
|
|||||||
for stat in hist_stats:
|
for stat in hist_stats:
|
||||||
project[stat] = True
|
project[stat] = True
|
||||||
project['_id'] = False
|
project['_id'] = False
|
||||||
|
bu.debug('find(): tank_id={} account_id={} last_battle_time>={}'.format(tank_id, account_id, battletime - time_buffer))
|
||||||
cursor = dbc.find({ '$and': [ { 'tank_id' : tank_id }, { 'account_id': account_id }, { 'last_battle_time': { '$gte': battletime - time_buffer }} ] }, projection=project).sort('last_battle_time',-1).limit(1)
|
cursor = dbc.find({ '$and': [ { 'tank_id' : tank_id }, { 'account_id': account_id }, { 'last_battle_time': { '$gte': battletime - time_buffer }} ] }, projection=project).sort('last_battle_time',-1).limit(1)
|
||||||
|
|
||||||
# pipeline = [ { '$match': { '$and': [ { 'account_id': account_id }, { 'last_battle_time': { '$lte': battletime + time_buffer }}, { 'tank_id' : tank_id } ]}},
|
# pipeline = [ { '$match': { '$and': [ { 'account_id': account_id }, { 'last_battle_time': { '$lte': battletime + time_buffer }}, { 'tank_id' : tank_id } ]}},
|
||||||
|
|||||||
Reference in new issue
Block a user