Move MusicGPT cost totals from pricing page to sales page

This commit is contained in:
Troll (Hermes Agent) 2026-08-11 03:16:28 +00:00
parent 0c79984619
commit af91664ed0
3 changed files with 29 additions and 26 deletions

9
app.py
View file

@ -739,13 +739,15 @@ def admin_dashboard():
def admin_sales():
"""
Sales report: delivered requests only.
Shows customer email, name, chosen version, and Square payment reference.
Shows customer email, name, chosen version, Square payment reference,
and aggregate MusicGPT generation/stems costs in USD.
"""
redir = require_admin()
if redir:
return redir
sales = list_requests(status='delivered')
return render_template('admin/sales.html', sales=sales, statuses=STATUS_LABELS)
cost_totals = get_musicgpt_cost_totals()
return render_template('admin/sales.html', sales=sales, statuses=STATUS_LABELS, cost_totals=cost_totals)
@app.route('/admin/pricing', methods=['GET', 'POST'])
@ -791,8 +793,7 @@ def admin_pricing():
'name': entry.get('name', '') if isinstance(entry, dict) else '',
'price': entry.get('price', '') if isinstance(entry, dict) else ''
})
cost_totals = get_musicgpt_cost_totals()
return render_template('admin/pricing.html', fixed=fixed, customs=customs, cost_totals=cost_totals)
return render_template('admin/pricing.html', fixed=fixed, customs=customs)
@app.route('/kiosk')

View file

@ -71,28 +71,7 @@
{% endfor %}
{% endwith %}
<div class="section" style="background:#1f2937;padding:1rem;border-radius:.5rem;margin-bottom:1rem">
<h2 style="margin-top:0">MusicGPT Costs (USD)</h2>
<div class="price-row">
<div>
<p class="hint" style="margin:0">Songs generated</p>
<p style="font-size:1.25rem;font-weight:700;margin:.25rem 0">{{ cost_totals.song_count }}</p>
</div>
<div>
<p class="hint" style="margin:0">Completed A/B pairs</p>
<p style="font-size:1.25rem;font-weight:700;margin:.25rem 0">{{ cost_totals.completed_pairs }}</p>
</div>
<div>
<p class="hint" style="margin:0">Music cost total</p>
<p style="font-size:1.25rem;font-weight:700;margin:.25rem 0">${{ "%.4f"|format(cost_totals.total_cost) }}</p>
</div>
<div>
<p class="hint" style="margin:0">Stems cost total</p>
<p style="font-size:1.25rem;font-weight:700;margin:.25rem 0">${{ "%.4f"|format(cost_totals.stems_total) }}</p>
</div>
</div>
<p class="hint" style="margin-top:.5rem">Per-song cost approx. $0.035$0.045 USD on the current MusicGPT plan (v6 / v6-pro).</p>
</div>
<!-- Pricing form removed from here; see admin/sales.html for MusicGPT cost totals. -->
<form method="POST">
<h2>Standard Items</h2>

View file

@ -42,6 +42,29 @@
<h1>Sales Report</h1>
{% if sales %}
<div class="section" style="background:#1f2937;padding:1rem;border-radius:.5rem;margin-bottom:1rem">
<h2 style="margin-top:0">MusicGPT Costs (USD)</h2>
<div class="price-row" style="display:grid;grid-template-columns:repeat(4,1fr);gap:1rem">
<div>
<p class="hint" style="margin:0">Songs generated</p>
<p style="font-size:1.25rem;font-weight:700;margin:.25rem 0">{{ cost_totals.song_count }}</p>
</div>
<div>
<p class="hint" style="margin:0">Completed A/B pairs</p>
<p style="font-size:1.25rem;font-weight:700;margin:.25rem 0">{{ cost_totals.completed_pairs }}</p>
</div>
<div>
<p class="hint" style="margin:0">Music cost total</p>
<p style="font-size:1.25rem;font-weight:700;margin:.25rem 0">${{ "%.4f"|format(cost_totals.total_cost) }}</p>
</div>
<div>
<p class="hint" style="margin:0">Stems cost total</p>
<p style="font-size:1.25rem;font-weight:700;margin:.25rem 0">${{ "%.4f"|format(cost_totals.stems_total) }}</p>
</div>
</div>
<p class="hint" style="margin-top:.5rem">Per-song cost approx. $0.035$0.045 USD on the current MusicGPT plan (v6 / v6-pro).</p>
</div>
<table>
<thead>
<tr>