mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 00:50:35 +00:00
Fixes user stats reporting
This commit is contained in:
parent
8f0ea4cc7a
commit
1f53ce33a8
1 changed files with 10 additions and 8 deletions
|
@ -56,17 +56,17 @@ def nodeinfo_pointer(_):
|
|||
@require_GET
|
||||
def nodeinfo(_):
|
||||
"""basic info about the server"""
|
||||
status_count = models.Status.objects.filter(user__local=True).count()
|
||||
user_count = models.User.objects.filter(local=True).count()
|
||||
status_count = models.Status.objects.filter(user__local=True, deleted=False).count()
|
||||
user_count = models.User.objects.filter(is_active=True, local=True).count()
|
||||
|
||||
month_ago = timezone.now() - relativedelta(months=1)
|
||||
last_month_count = models.User.objects.filter(
|
||||
local=True, last_active_date__gt=month_ago
|
||||
is_active=True, local=True, last_active_date__gt=month_ago
|
||||
).count()
|
||||
|
||||
six_months_ago = timezone.now() - relativedelta(months=6)
|
||||
six_month_count = models.User.objects.filter(
|
||||
local=True, last_active_date__gt=six_months_ago
|
||||
is_active=True, local=True, last_active_date__gt=six_months_ago
|
||||
).count()
|
||||
|
||||
site = models.SiteSettings.get()
|
||||
|
@ -91,8 +91,8 @@ def nodeinfo(_):
|
|||
@require_GET
|
||||
def instance_info(_):
|
||||
"""let's talk about your cool unique instance"""
|
||||
user_count = models.User.objects.filter(local=True).count()
|
||||
status_count = models.Status.objects.filter(user__local=True).count()
|
||||
user_count = models.User.objects.filter(is_active=True, local=True).count()
|
||||
status_count = models.Status.objects.filter(user__local=True, deleted=False).count()
|
||||
|
||||
site = models.SiteSettings.get()
|
||||
logo_path = site.logo_small or "images/logo-small.png"
|
||||
|
@ -111,7 +111,7 @@ def instance_info(_):
|
|||
"thumbnail": logo,
|
||||
"languages": ["en"],
|
||||
"registrations": site.allow_registration,
|
||||
"approval_required": False,
|
||||
"approval_required": site.allow_registration and site.allow_invite_requests,
|
||||
"email": site.admin_email,
|
||||
}
|
||||
)
|
||||
|
@ -120,7 +120,9 @@ def instance_info(_):
|
|||
@require_GET
|
||||
def peers(_):
|
||||
"""list of federated servers this instance connects with"""
|
||||
names = models.FederatedServer.objects.values_list("server_name", flat=True)
|
||||
names = models.FederatedServer.objects.values_list(
|
||||
"server_name", flat=True, status="federated"
|
||||
)
|
||||
return JsonResponse(list(names), safe=False)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue