Expand dashboard analytics and document production implementation

This commit is contained in:
maxwes08
2026-11-03 14:49:01 +01:00
parent 70b94f8672
commit aa0028e7e0
36 changed files with 2212 additions and 76 deletions

View File

@@ -42,6 +42,7 @@ def seed():
conn.execute("SET LOCAL statement_timeout=0")
populate(conn)
print("Seeded three games with 90 days of sample data.")
conn.execute((DB_FILES/'seed_interactions.sql').read_text(encoding='utf-8'))
with connect() as conn:
conn.execute("ANALYZE")
status()
@@ -52,6 +53,7 @@ def reseed():
conn.execute('SET LOCAL statement_timeout=0')
reset_sample(conn)
populate(conn)
conn.execute((DB_FILES/'seed_interactions.sql').read_text(encoding='utf-8'))
with connect() as conn:
conn.execute('ANALYZE')
status()
@@ -60,7 +62,7 @@ def reseed():
def status():
with connect() as conn:
counts = {}
for table in ("games", "players", "sessions", "player_snapshots", "events", "game_metrics", "activity_runs", "products", "product_sales", "gamepasses", "gamepass_ownership"):
for table in ("games", "players", "sessions", "player_snapshots", "events", "game_metrics", "activity_runs", "products", "product_sales", "gamepasses", "gamepass_ownership", "interaction_events"):
counts[table] = conn.execute(sql.SQL("SELECT count(*) AS count FROM {}").format(sql.Identifier(table))).fetchone()["count"]
print("PostgreSQL sample records: " + ", ".join(f"{k}={v:,}" for k, v in counts.items()))