mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-21 10:17:05 +02:00
reverse get_db_tank_tier_stats() changes
This commit is contained in:
1 parent
9c8dc8d005
commit
5ad93c84df
1 file changed
+2
-2
@@ -1611,7 +1611,7 @@ async def get_db_tank_tier_stats(db : motor.motor_asyncio.AsyncIOMotorDatabase,
|
|||||||
dbc = db[DB_C_TANK_STATS]
|
dbc = db[DB_C_TANK_STATS]
|
||||||
( account_id, tier, battletime ) = str2ints(stat_id_str)
|
( account_id, tier, battletime ) = str2ints(stat_id_str)
|
||||||
tier_tanks = wg.get_tanks_by_tier(tier)
|
tier_tanks = wg.get_tanks_by_tier(tier)
|
||||||
time_buffer = 8*7*24*3600
|
time_buffer = 2*7*24*3600
|
||||||
#bu.debug('Tank_ids: ' + ','.join(map(str, tier_tanks)))
|
#bu.debug('Tank_ids: ' + ','.join(map(str, tier_tanks)))
|
||||||
|
|
||||||
# if battletime == None:
|
# if battletime == None:
|
||||||
@@ -1621,7 +1621,7 @@ async def get_db_tank_tier_stats(db : motor.motor_asyncio.AsyncIOMotorDatabase,
|
|||||||
# { '$replaceRoot': { 'newRoot': '$doc' }},
|
# { '$replaceRoot': { 'newRoot': '$doc' }},
|
||||||
# { '$project': { '_id': 0 }} ]
|
# { '$project': { '_id': 0 }} ]
|
||||||
# else:
|
# else:
|
||||||
pipeline = [ { '$match': { '$and': [ { 'account_id': account_id }, { 'last_battle_time': { '$gte': battletime - time_buffer }}, { 'tank_id' : {'$in': tier_tanks} } ]}},
|
pipeline = [ { '$match': { '$and': [ { 'account_id': account_id }, { 'last_battle_time': { '$lte': battletime + time_buffer }}, { 'tank_id' : {'$in': tier_tanks} } ]}},
|
||||||
{ '$sort': { 'last_battle_time': -1 }},
|
{ '$sort': { 'last_battle_time': -1 }},
|
||||||
{ '$group': { '_id': '$tank_id', 'doc': { '$first': '$$ROOT' }}},
|
{ '$group': { '_id': '$tank_id', 'doc': { '$first': '$$ROOT' }}},
|
||||||
{ '$replaceRoot': { 'newRoot': '$doc' }},
|
{ '$replaceRoot': { 'newRoot': '$doc' }},
|
||||||
|
|||||||
Reference in new issue
Block a user