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

@@ -29,7 +29,7 @@ def copy_rows(conn, table, columns, records):
def reset_sample(conn):
"""Remove only the bundled samples; keep games and unrelated projects intact."""
gids = [r['id'] for r in conn.execute('SELECT id FROM games WHERE sample_key=ANY(%s)', (list(SAMPLE_KEYS),))]
for table in ('gamepass_ownership', 'product_sales', 'activity_runs', 'events',
for table in ('daily_health_reports', 'interaction_events', 'gamepass_ownership', 'product_sales', 'activity_runs', 'events',
'player_snapshots', 'sessions', 'game_metrics', 'players',
'gamepasses', 'products', 'activity_definitions', 'column_templates', 'player_fields'):
conn.execute(sql.SQL('DELETE FROM {} WHERE game_id=ANY(%s)').format(sql.Identifier(table)), (gids,))
@@ -176,17 +176,13 @@ def populate(conn, players_per_game=6000):
spent[pid] += price*quantity
units[pid] += quantity
buys.append((product,quantity,price,at))
for product,quantity,price,at in buys:
if seconds>60 and (buys or rng.random()<.23):
definition=defs['shop']
activity('shop',pid,sid,at-timedelta(seconds=10),at+timedelta(seconds=5),'purchased',
[definition['start_event']]+definition['configuration']['steps']+[definition['end_event']],
{'product_id':product['roblox_product_id'],'purchase_amount':price*quantity,'currency_balance':balances[pid]},1)
if not buys and seconds>60 and rng.random()<.23:
definition=defs['shop']
count=rng.choices([0,1,2], [.15,.65,.2])[0]
progress=[definition['start_event']]+definition['configuration']['steps'][:count]
progress=[definition['start_event']]
if buys or rng.random()<.85:
progress.append('product_viewed')
activity('shop',pid,sid,start+(end-start)*.15,start+(end-start)*.3,'closed',
progress+[definition['end_event']],{'currency_balance':balances[pid]},int(count==2))
progress+[definition['end_event']],{'currency_balance':balances[pid]})
for key, chance in [('minigame',.6),('quest',.35)]:
if seconds<180 or rng.random()>chance:
continue