Expose version in /stats/ endpoint
This commit is contained in:
parent
247efc5345
commit
1d5c1a067a
2 changed files with 4 additions and 0 deletions
|
@ -8,6 +8,7 @@ from django.contrib.auth import get_user, get_user_model
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.test import RequestFactory
|
from django.test import RequestFactory
|
||||||
|
|
||||||
|
from umap import VERSION
|
||||||
from umap.views import validate_url
|
from umap.views import validate_url
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,6 +158,7 @@ def test_stats_empty(client):
|
||||||
"maps_count": 0,
|
"maps_count": 0,
|
||||||
"users_active_last_week_count": 0,
|
"users_active_last_week_count": 0,
|
||||||
"users_count": 0,
|
"users_count": 0,
|
||||||
|
"version": VERSION,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,6 +174,7 @@ def test_stats_basic(client, map, datalayer, user2):
|
||||||
"maps_count": 1,
|
"maps_count": 1,
|
||||||
"users_active_last_week_count": 1,
|
"users_active_last_week_count": 1,
|
||||||
"users_count": 2,
|
"users_count": 2,
|
||||||
|
"version": VERSION,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -883,6 +883,7 @@ def stats(request):
|
||||||
last_week = date.today() - timedelta(days=7)
|
last_week = date.today() - timedelta(days=7)
|
||||||
return simple_json_response(
|
return simple_json_response(
|
||||||
**{
|
**{
|
||||||
|
"version": VERSION,
|
||||||
"maps_count": Map.objects.count(),
|
"maps_count": Map.objects.count(),
|
||||||
"maps_active_last_week_count": Map.objects.filter(
|
"maps_active_last_week_count": Map.objects.filter(
|
||||||
modified_at__gt=last_week
|
modified_at__gt=last_week
|
||||||
|
|
Loading…
Reference in a new issue