Guard customer_approved null/None in all templates
Some rows (schema drift, cancelled requests, manual status edits) have customer_approved = NULL instead of the default 'none'. Templates called .upper() on it blindly, causing a Jinja2 UndefinedError / 500 when the customer player or admin pages loaded. Replace all .upper() calls with (value or 'none').upper() and add truthy checks before rendering the approved choice in status.html and dashboard.html.
This commit is contained in:
parent
9524a24715
commit
2b46f7d3dc
5 changed files with 6 additions and 6 deletions
|
|
@ -164,7 +164,7 @@
|
||||||
<td>{{ r.email }}</td>
|
<td>{{ r.email }}</td>
|
||||||
<td>{{ r.style_genre or '-' }}</td>
|
<td>{{ r.style_genre or '-' }}</td>
|
||||||
<td><span class="status-badge {{ r.status }}">{{ statuses[r.status] }}</span></td>
|
<td><span class="status-badge {{ r.status }}">{{ statuses[r.status] }}</span></td>
|
||||||
<td>{% if r.customer_approved != 'none' %}{{ r.customer_approved.upper() }}{% else %}-{% endif %}</td>
|
<td>{% if r.customer_approved and r.customer_approved != 'none' %}{{ (r.customer_approved or 'none').upper() }}{% else %}-{% endif %}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<a href="{{ url_for('admin_request', rid=r.id) }}">Open</a>
|
<a href="{{ url_for('admin_request', rid=r.id) }}">Open</a>
|
||||||
<form method="POST" action="{{ url_for('admin_delete_request', rid=r.id) }}" style="display:inline" onsubmit="return confirm('ARE YOU SURE you want to delete request #{{ r.id }} for {{ r.name }}? This cannot be undone.')">
|
<form method="POST" action="{{ url_for('admin_delete_request', rid=r.id) }}" style="display:inline" onsubmit="return confirm('ARE YOU SURE you want to delete request #{{ r.id }} for {{ r.name }}? This cannot be undone.')">
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,7 @@
|
||||||
{% if req.customer_approved == 'none' %}
|
{% if req.customer_approved == 'none' %}
|
||||||
<span class="approved-box">Nothing yet</span>
|
<span class="approved-box">Nothing yet</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="approved-box">{{ req.customer_approved.upper() }}</span>
|
<span class="approved-box">{{ (req.customer_approved or 'none').upper() }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
<td>#{{ s.id }}</td>
|
<td>#{{ s.id }}</td>
|
||||||
<td>{{ s.name }}</td>
|
<td>{{ s.name }}</td>
|
||||||
<td>{{ s.email }}</td>
|
<td>{{ s.email }}</td>
|
||||||
<td>{% if s.customer_approved == 'both' %}Both Versions{% else %}Version {{ s.customer_approved.upper() }}{% endif %}</td>
|
<td>{% if s.customer_approved == 'both' %}Both Versions{% else %}Version {{ (s.customer_approved or 'none').upper() }}{% endif %}</td>
|
||||||
<td>{{ s.square_payment_ref or '-' }}</td>
|
<td>{{ s.square_payment_ref or '-' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@
|
||||||
<!-- Customer already picked a version; show their choice and payment instruction -->
|
<!-- Customer already picked a version; show their choice and payment instruction -->
|
||||||
<div class="locked">
|
<div class="locked">
|
||||||
<h2>✅ Choice Received</h2>
|
<h2>✅ Choice Received</h2>
|
||||||
<p>You selected:</span> <strong>{% if req.customer_approved == 'both' %}Both Versions{% else %}Version {{ req.customer_approved.upper() }}{% endif %}</strong></p>
|
<p>You selected: <strong>{% if req.customer_approved == 'both' %}Both Versions{% else %}Version {{ (req.customer_approved or 'none').upper() }}{% endif %}</strong></p>
|
||||||
{% if req.status == 'awaiting_payment' %}
|
{% if req.status == 'awaiting_payment' %}
|
||||||
<p>Please return to the booth to finalize payment and collect your files.</p>
|
<p>Please return to the booth to finalize payment and collect your files.</p>
|
||||||
{% elif req.status == 'paid' %}
|
{% elif req.status == 'paid' %}
|
||||||
|
|
|
||||||
|
|
@ -168,8 +168,8 @@
|
||||||
<h3>Request #{{ req.id }} — {{ req.name }}</h3>
|
<h3>Request #{{ req.id }} — {{ req.name }}</h3>
|
||||||
<p><strong>Status:</strong> <span class="status {{ req.status }}">{{ statuses[req.status] }}</span></p>
|
<p><strong>Status:</strong> <span class="status {{ req.status }}">{{ statuses[req.status] }}</span></p>
|
||||||
|
|
||||||
{% if req.customer_approved != 'none' %}
|
{% if req.customer_approved and req.customer_approved != 'none' %}
|
||||||
<p class="approved">You selected: {% if req.customer_approved == 'both' %}Both Versions{% else %}Version {{ req.customer_approved.upper() }}{% endif %}</p>
|
<p class="approved">You selected: {% if req.customer_approved == 'both' %}Both Versions{% else %}Version {{ (req.customer_approved or 'none').upper() }}{% endif %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if req.song_a_path and req.song_b_path %}
|
{% if req.song_a_path and req.song_b_path %}
|
||||||
|
|
|
||||||
Reference in a new issue