This commit is contained in:
kf_wuhao 2021-01-14 10:09:22 +08:00
parent 048f9958dc
commit b814161c5f

View File

@ -207,9 +207,14 @@ class Summary3(Task):
for doc in cursor: for doc in cursor:
doc_date = doc['cdate'] doc_date = doc['cdate']
age_day = (cdate - doc_date) // 86400 + 1 age_day = (cdate - doc_date) // 86400 + 1
data = {f'{cat}_all_money_{age_day}': doc[f'{cat}_all_money_{age_day - 1}']} try:
self.local_db[f'summary_{cat}'].update_one({'_id': doc['_id']}, {'$set': data}) age_idx = RETAIN_DAYS.index(age_day)
self.remote_db[f'summary_{cat}'].update_one({'_id': doc['_id']}, {'$set': data}) except ValueError:
continue
else:
data = {f'{cat}_all_money_{age_day}': doc[f'{cat}_all_money_{RETAIN_DAYS[age_idx - 1]}']}
self.local_db[f'summary_{cat}'].update_one({'_id': doc['_id']}, {'$set': data})
self.remote_db[f'summary_{cat}'].update_one({'_id': doc['_id']}, {'$set': data})
update('role') update('role')
update('account') update('account')