feat: add admin stats
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user