This commit is contained in:
Xavier Fiechter 2024-12-06 17:10:16 +01:00
parent cb5a782c13
commit 3a26ef3399
2 changed files with 48 additions and 5 deletions

View file

@ -5,5 +5,8 @@ register = template.Library()
@register.simple_tag
def is_label_id_in_queue(label_id):
return Task.objects.filter(task_name="finances.tasks.check_spent",
task_params__contains=label_id).exists()
try:
return Task.objects.filter(task_name="finances.tasks.check_spent",
task_params__contains=label_id).exists()
except:
return False

View file

@ -120,7 +120,8 @@
</div>
{% endif %}
{% is_label_id_in_queue object.id as is_in_queue %}
{% comment %}
{% is_label_id_in_queue object.id as is_in_queue %}
{% if is_in_queue %}
<div class="alert bd-callout bd-callout-info">
<!--div class="btn-group" role="group" style="position: absolute; top: -8px; right: -4px; padding: 1.25rem 1rem;">
@ -135,7 +136,7 @@
</div-->
<strong>Output in queue!</strong> This output is currently in the processing queue. It will be checked shortly.
</div>
{% else %}
{% else %}
{% if object.type == "output" %}
{% switch output.get_spent_status %}
{% case "spent" %}
@ -162,9 +163,48 @@
{% endswitch %}
{% endif %}
{% endif %}
{% endcomment %}
{% is_label_id_in_queue object.id as is_in_queue %}
{% if is_in_queue %}
<div class="alert bd-callout bd-callout-info">
<strong>Output in queue!</strong> This output is currently in the processing queue. It will be checked shortly.
</div>
{% else %}
{% if object.type == "output" %}
{% if output.get_spent_status == "spent" %}
<div class="bd-callout bd-callout-warning">
<strong>Output spent!</strong> Blockchain records indicate that this output has been spent in another transaction.
</div>
{% elif output.get_spent_status == "unspent" %}
<div class="bd-callout bd-callout-good">
<strong>Output unspent!</strong> Blockchain records indicate that this output has not been spent yet.
</div>
{% elif output.get_spent_status == "unconfirmed" %}
<div class="alert bd-callout bd-callout-info">
<div class="btn-group" role="group" style="position: absolute; top: -8px; right: -4px; padding: 1.25rem 1rem;">
<button type="button" class="btn btn-sm btn-outline-info dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Actions
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="{% url 'outputstat_update_redirect' output_stats_id=output.id label_id=object.id %}?force-spent=none">
Verify output status
</a>
</li>
</ul>
</div>
<strong>Output unconfirmed!</strong> Blockchain records indicate that this output has not been confirmed yet.
</div>
{% else %}
<div class="bd-callout bd-callout-warning">
<strong>Unknown status:</strong> The status of this output could not be determined.
</div>
{% endif %}
{% endif %}
{% endif %}
<!-- t: {{ object.type }} -->
<!-- spent: {{output.get_spent_status }} -->
<!-- spent: {{output.get_spent_status }} -->
<!--div class="bd-callout bd-callout-warning">