fix
This commit is contained in:
parent
54b263f20c
commit
e0e8fa8f6b
2 changed files with 20 additions and 2 deletions
|
|
@ -146,6 +146,20 @@ def get_users():
|
|||
''')
|
||||
total_gamers = cursor.fetchone()[0]
|
||||
|
||||
# Count new users today
|
||||
today = date.today().isoformat()
|
||||
cursor.execute("SELECT COUNT(*) FROM telegram_users WHERE DATE(created_at) = ?", (today,))
|
||||
users_today = cursor.fetchone()[0]
|
||||
|
||||
# Count new gamers today (from user_gamers table)
|
||||
cursor.execute("""
|
||||
SELECT COUNT(DISTINCT g.id)
|
||||
FROM user_gamers ug
|
||||
JOIN gamers g ON ug.gamer_id = g.id
|
||||
WHERE DATE(ug.created_at) = ?
|
||||
""", (today,))
|
||||
gamers_today = cursor.fetchone()[0]
|
||||
|
||||
# Get message counters statistics
|
||||
message_stats = get_message_counters_stats(DB_PATH)
|
||||
|
||||
|
|
@ -162,7 +176,9 @@ def get_users():
|
|||
'success': True,
|
||||
'users': users,
|
||||
'total_users': len(users),
|
||||
'users_today': users_today,
|
||||
'total_gamers': total_gamers,
|
||||
'gamers_today': gamers_today,
|
||||
'message_stats': message_stats
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue