diff --git a/LichessWebView/app.py b/LichessWebView/app.py index dc2e138..5046122 100644 --- a/LichessWebView/app.py +++ b/LichessWebView/app.py @@ -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 }) diff --git a/LichessWebView/templates/index.html b/LichessWebView/templates/index.html index 0999d32..de0d378 100644 --- a/LichessWebView/templates/index.html +++ b/LichessWebView/templates/index.html @@ -285,8 +285,8 @@