From 1d5c1a067ac83aa6c4b8beb30e1a9482f8ec4db6 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 20 Jun 2023 15:14:28 +0200 Subject: [PATCH] Expose version in /stats/ endpoint --- umap/tests/test_views.py | 3 +++ umap/views.py | 1 + 2 files changed, 4 insertions(+) diff --git a/umap/tests/test_views.py b/umap/tests/test_views.py index dc385917..fc05b4b4 100644 --- a/umap/tests/test_views.py +++ b/umap/tests/test_views.py @@ -8,6 +8,7 @@ from django.contrib.auth import get_user, get_user_model from django.urls import reverse from django.test import RequestFactory +from umap import VERSION from umap.views import validate_url @@ -157,6 +158,7 @@ def test_stats_empty(client): "maps_count": 0, "users_active_last_week_count": 0, "users_count": 0, + "version": VERSION, } @@ -172,6 +174,7 @@ def test_stats_basic(client, map, datalayer, user2): "maps_count": 1, "users_active_last_week_count": 1, "users_count": 2, + "version": VERSION, } diff --git a/umap/views.py b/umap/views.py index 35d350b3..cdd893a1 100644 --- a/umap/views.py +++ b/umap/views.py @@ -883,6 +883,7 @@ def stats(request): last_week = date.today() - timedelta(days=7) return simple_json_response( **{ + "version": VERSION, "maps_count": Map.objects.count(), "maps_active_last_week_count": Map.objects.filter( modified_at__gt=last_week