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
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -285,8 +285,8 @@
|
|||
<h1>👥 Пользователи</h1>
|
||||
|
||||
<div class="stats">
|
||||
Всего пользователей: <strong id="total-users">0</strong><br>
|
||||
Кол-во игроков: <strong id="total-gamers">0</strong>
|
||||
Всего пользователей: <strong id="total-users">0</strong> (сегодня: <strong id="users-today">0</strong>)<br>
|
||||
Кол-во игроков: <strong id="total-gamers">0</strong> (сегодня: <strong id="gamers-today">0</strong>)
|
||||
</div>
|
||||
|
||||
<div class="stats" style="margin-top: 15px; padding: 15px; background: #E8D5B7; border-radius: 8px;">
|
||||
|
|
@ -352,7 +352,9 @@
|
|||
if (data.success) {
|
||||
users = data.users;
|
||||
document.getElementById('total-users').textContent = data.total_users;
|
||||
document.getElementById('users-today').textContent = data.users_today || 0;
|
||||
document.getElementById('total-gamers').textContent = data.total_gamers;
|
||||
document.getElementById('gamers-today').textContent = data.gamers_today || 0;
|
||||
|
||||
// Update message counters
|
||||
if (data.message_stats) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue