feat: add admin stats

This commit is contained in:
2026-10-25 10:48:54 +01:00
parent 6cee1135a8
commit 1844b973e9
8 changed files with 443 additions and 5 deletions
+10
View File
@@ -18,6 +18,8 @@ from .heatmap import (
build_heatmap_png,
)
from .models import PixelPlacement, PlaceSettings
from .schemas import PlaceStatsOut
from .stats import build_place_stats
router = Router()
@@ -104,6 +106,14 @@ def heatmap_decay_gif(
)
@router.get(f"{PREFIX}/stats", auth=django_auth_is_staff, response=PlaceStatsOut)
@decorate_view(require_game_enabled(path="place"))
def stats(request: HttpRequest, event_path: str):
"""Admin-only: aggregated stats about the game - totals, coverage, top
players, most contested pixels, color usage and activity per hour."""
return build_place_stats(request.event)
@router.get(f"{PREFIX}/placements.csv", auth=django_auth_is_staff)
@decorate_view(require_game_enabled(path="place"))
def placements_csv(request: HttpRequest, event_path: str):