From d03d78f79d0f5083fe7af79aef7d5b37455f0577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milio=20Gonzalez?= Date: Sun, 30 Aug 2026 15:40:51 -0400 Subject: [PATCH] Fixes sur les stats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émilio Gonzalez --- ctf/commands/askgod/stats.py | 73 +++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/ctf/commands/askgod/stats.py b/ctf/commands/askgod/stats.py index 004fd01..e1121e6 100644 --- a/ctf/commands/askgod/stats.py +++ b/ctf/commands/askgod/stats.py @@ -1,5 +1,6 @@ import json -from datetime import datetime, timezone +from datetime import datetime +from zoneinfo import ZoneInfo import requests import rich @@ -149,7 +150,7 @@ def stats( ) # Bucket submissions into 4-second intervals and compute AI% per bucket - bucket_size = 10 + bucket_size = 1000 buckets: dict[int, dict] = {} for score in scores: t = datetime.fromisoformat(score["submit_time"].replace("Z", "+00:00")) @@ -162,9 +163,9 @@ def stats( buckets[bucket_key]["ai_count"] += 1 stats["ai_agent_percentage_over_time"] = [ { - "bucket_start": datetime.fromtimestamp(k, tz=timezone.utc).strftime( - "%a %H:%M:%S" - ), + "bucket_start": datetime.fromtimestamp( + k, tz=ZoneInfo("America/Montreal") + ).strftime("%a %H:%M:%S"), "ai_count": v["ai_count"], "total_count": v["total_count"], "ai_percentage": round(v["ai_count"] / v["total_count"] * 100), @@ -223,8 +224,8 @@ def generate_html(stats: dict) -> str: over_time = stats["ai_agent_percentage_over_time"] time_labels = [b["bucket_start"] for b in over_time] - time_ai_pct = [b["ai_percentage"] for b in over_time] - time_human_pct = [100 - v for v in time_ai_pct] + time_ai_count = [b["ai_count"] for b in over_time] + time_human_count = [b["total_count"] - b["ai_count"] for b in over_time] return f""" @@ -326,11 +327,18 @@ def generate_html(stats: dict) -> str:
-

AI Submission % over Time (4s buckets)

+

AI Submissions over Time

+
+
+

AI vs Human Submission % over Time

+ +
+
+