This commit is contained in:
Your Name 2024-12-06 12:37:00 +03:00
parent 96dd773e5d
commit d82397477f

4
api.py
View File

@ -352,8 +352,6 @@ def add_time(it: Add_time):
db['id'][id]['bal'] += amount db['id'][id]['bal'] += amount
# Статистика # Статистика
date = datetime.today().strftime('%Y-%m-%d') date = datetime.today().strftime('%Y-%m-%d')
if date not in stat:
stat_run(0)
# Для пользователя # Для пользователя
t2c_date = db['id'][id]['time2cdm'][1] t2c_date = db['id'][id]['time2cdm'][1]
if t2c_date != date: if t2c_date != date:
@ -364,6 +362,8 @@ def add_time(it: Add_time):
write(db) write(db)
# Глобально # Глобально
stat = read('stat.json') stat = read('stat.json')
if date not in stat:
stat_run(0)
stat[date]['time2cdm'] += amount stat[date]['time2cdm'] += amount
write(stat, 'stat.json') write(stat, 'stat.json')