From b11f239004eab115edb1234600c57d3d93593400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Thu, 30 Jan 2025 10:45:37 +0200 Subject: [PATCH] Add code comment about SQL queries in hc.front.views.ping_details --- hc/front/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hc/front/views.py b/hc/front/views.py index 44e083249cd..9a912a1728b 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -742,6 +742,10 @@ def validate_schedule(request: HttpRequest) -> HttpResponse: def ping_details( request: AuthenticatedHttpRequest, code: UUID, n: int | None = None ) -> HttpResponse: + # This view makes two non-obvious SQL queries: + # * it calls ping.get_body(), which reads self.owner.code, triggering a query + # * the template calls ping.duration() which queries past "/start" events + check, rw = _get_check_for_user(request, code) q = Ping.objects.filter(owner=check) if n: