thousand-separators for counts

useful when there are very many events
This commit is contained in:
Klaas van Schelven
2025-02-19 16:46:59 +01:00
parent 154dceb2af
commit bc1541050d
7 changed files with 18 additions and 11 deletions

View File

@@ -59,6 +59,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'tailwind', # As currently set up, this is also needed in production (templatetags)
'admin_auto_filters',

View File

@@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load static %}
{% load issues %}
{% load humanize %}
{% load stricter_templates %}
{% block title %}{{ issue.title }} · {{ block.super }}{% endblock %}
@@ -119,7 +120,7 @@
</div>
<div class="flex p-4 bg-slate-200 border-b-2"><!-- bottom nav bar -->
{% if is_event_page %}<div>Event {{ event.digest_order }} of {{ issue.digested_event_count}} which occured at <span class="font-bold">{{ event.ingested_at|date:"j M G:i T" }}</span></div>{% endif %}
{% if is_event_page %}<div>Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }} which occured at <span class="font-bold">{{ event.ingested_at|date:"j M G:i T" }}</span></div>{% endif %}
<div class="ml-auto pr-4 font-bold text-slate-500">
{% if is_event_page %}
<a href="/events/event/{{ event.id }}/download/">Download</a>
@@ -183,7 +184,7 @@
<div class="mb-4">
<div class="text-sm font-bold text-slate-500">Nr. of events:</div>
<div>{{ issue.digested_event_count }}</div>
<div>{{ issue.digested_event_count|intcomma }}</div>
</div>
{% if issue.digested_event_count > 1 %}

View File

@@ -2,12 +2,13 @@
{% load static %}
{% load stricter_templates %}
{% load issues %}
{% load humanize %}
{% block tab_content %}
<div class="flex">
<div class="overflow-hidden">
<div class="italic">{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order }} of {{ issue.digested_event_count }})</div>
<div class="italic">{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }})</div>
</div>
<div class="ml-auto flex-none">

View File

@@ -1,12 +1,13 @@
{% extends "issues/base.html" %}
{% load static %}
{% load stricter_templates %}
{% load humanize %}
{% block tab_content %}
<div class="flex">
<div class="overflow-hidden">
<div class="italic">{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order }} of {{ issue.digested_event_count }})</div>
<div class="italic">{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }})</div>
</div>
<div class="ml-auto flex-none">

View File

@@ -1,14 +1,15 @@
{% extends "issues/base.html" %}
{% load issues %}
{% load humanize %}
{% block tab_content %}
<div class="flex">
<div class="overflow-hidden">
<div class="italic">
Showing {{ page_obj.start_index }} - {{ page_obj.end_index }} of {{ page_obj.paginator.count }}
Showing {{ page_obj.start_index|intcomma }} - {{ page_obj.end_index|intcomma }} of {{ page_obj.paginator.count|intcomma }}
{% if project.digested_event_count != project.stored_event_count %}
available events ({{ project.digested_event_count }} total observed).
available events ({{ project.digested_event_count|intcomma }} total observed).
{% else %}
total events.
{% endif %}

View File

@@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load static add_to_qs %}
{% load humanize %}
{% block title %}Issues · {{ project.name }} · {{ site_title }}{% endblock %}
@@ -143,7 +144,7 @@
<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 9.75 19.5 12m0 0 2.25 2.25M19.5 12l2.25-2.25M19.5 12l-2.25 2.25m-10.5-6 4.72-4.72a.75.75 0 0 1 1.28.53v15.88a.75.75 0 0 1-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.009 9.009 0 0 1 2.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75Z" />
</svg>&nbsp;&nbsp;{% endif %}{{ issue.title|truncatechars:100 }}</a>
</div>
<div class="text-sm">from <b>{{ issue.first_seen|date:"j M G:i T" }}</b> | last <b>{{ issue.last_seen|date:"j M G:i T" }}</b> | with <b>{{ issue.digested_event_count }}</b> events
<div class="text-sm">from <b>{{ issue.first_seen|date:"j M G:i T" }}</b> | last <b>{{ issue.last_seen|date:"j M G:i T" }}</b> | with <b>{{ issue.digested_event_count|intcomma }}</b> events
{% if issue.transaction %}| <span class="font-bold">{{ issue.transaction }} </span>{% endif %}
</div>
</td>
@@ -191,9 +192,9 @@
{% endif %}
{% if page_obj.paginator.num_pages > 1 %}
Issues {{ page_obj.start_index }}{{ page_obj.end_index }} of {{ page_obj.paginator.count }}
Issues {{ page_obj.start_index|intcomma }}{{ page_obj.end_index|intcomma }} of {{ page_obj.paginator.count|intcomma }}
{% elif page_obj.paginator.count > 0 %}
{{ page_obj.paginator.count }} Issues
{{ page_obj.paginator.count|intcomma }} Issues
{% endif %}
{% if page_obj.has_next %}

View File

@@ -2,6 +2,7 @@
{% load static %}
{% load stricter_templates %}
{% load issues %}
{% load humanize %}
{% block tab_content %}
@@ -9,7 +10,7 @@
{# event-nav only #}
<div class="flex">
<div class="overflow-hidden">
<div class="italic">{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order }} of {{ issue.digested_event_count }})</div>
<div class="italic">{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }})</div>
</div>
<div class="ml-auto flex-none">
@@ -30,7 +31,7 @@
<div class="flex">
<div class="overflow-hidden">
{% if forloop.counter0 == 0 %}
<div class="italic">{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order }} of {{ issue.digested_event_count }})</div>
<div class="italic">{{ event.ingested_at|date:"j M G:i T" }} (Event {{ event.digest_order|intcomma }} of {{ issue.digested_event_count|intcomma }})</div>
{% endif %}
<h1 class="text-2xl font-bold {% if forloop.counter0 > 0 %}mt-4{% endif %} text-ellipsis whitespace-nowrap overflow-hidden">{{ exception.type }}</h1>
<div class="text-lg mb-4 text-ellipsis whitespace-nowrap overflow-hidden">{{ exception.value }}</div>