[stats] Adding daily query stats
@@ -475,11 +475,17 @@ class Analytics():
@classmethod
def admin_stats(cls):
stats = []
+ one_day = datetime.date.today() - timedelta(days=1)
one_week = datetime.date.today() - timedelta(weeks=1)
one_month = datetime.date.today() - timedelta(days=30)
three_months = datetime.date.today() - timedelta(days=90)
- stats.append(('Last modified', '1 week'))
+ stats.append(('Last modified', '1 day'))
+ stats.append(('Users', User.objects.filter(last_login__gte=one_day).count()))
+ stats.append(('Sessions', Session.objects.filter(expire_date__gte=one_day).count()))
+ stats.append(('Executed queries', Document2.objects.filter(last_modified__gte=one_day, is_history=True, type__startswith='query-').count()))
+
+ stats.append(('\nLast modified', '1 week'))
stats.append(('Users', User.objects.filter(last_login__gte=one_week).count()))
stats.append(('Sessions', Session.objects.filter(expire_date__gte=one_week).count()))
stats.append(('Executed queries', Document2.objects.filter(last_modified__gte=one_week, is_history=True, type__startswith='query-').count()))
