BirdNET-stream/www/templates/stats.html.twig

79 lines
2.6 KiB
Twig
Raw Permalink Normal View History

2022-08-15 11:42:28 +02:00
<div id="stats">
<h2>
{{ 'Quick Stats'|trans }}
</h2>
<ul>
<li class="stat">
{{ 'Most recorded species'|trans }}:{% if
stats['most-recorded-species'] is defined
and (stats['most-recorded-species']|length) > 0 %}
<span class="scientific-name">
{{ stats['most-recorded-species']['scientific_name'] }}
</span>
(<span class="common_name">
{{ stats['most-recorded-species']['common_name'] }}
</span>)
{{ 'with'|trans }}
<span class="observation-count">
{{ stats['most-recorded-species']['contact_count'] }}
</span>
{{ 'contacts'|trans }}.
{% else %}
{{ 'No species in database.'|trans }}
{% endif %}
</li>
<li class="stat">
{{ 'Last detected species'|trans }}:{% if
stats['last-detected-species'] is defined
and (stats['last-detected-species']|length) > 0 %}
<span class="scientific-name">
{{ stats['last-detected-species']['scientific_name'] }}
</span>
(<span class="common_name">
{{ stats['last-detected-species']['common_name'] }}
</span>)
{{ 'with'|trans }}
<span class="confidence">
{{ stats['last-detected-species']['confidence'] }}
</span>
{{ 'AI confidence'|trans }}
<span class="datetime">
{% set date = stats['last-detected-species']['date'] %}
{% if (date|date('Y-m-d')) == ('now'|date('Y-m-d')) %}
{{ 'today'|trans }}
{% else %}
{{ 'on'|trans }}
{{ date|format_datetime('full', 'none') }}
{% endif %}at
<span class="time">{{ date|date('H:i') }}</span>
</span>.
{% else %}
{{ 'No species in database'|trans }}
{% endif %}
</li>
<li class="stat">
{% set today = 'now'|date('Y-m-d') %}
{% set date = app.request.get('on') %}
{% if
stats['number-of-species-detected'] is defined
and stats['number-of-species-detected'] > 0 %}
{% if today == date %}
{{ 'Number of species detected today: '|trans }}
{% else %}
{{ 'Number of species detected on '|trans }}
{{ date|format_datetime('full', 'none') }}:
{% endif %}
<span>{{ stats['number-of-species-detected'] }}</span>.
{% else %}
{# {{ 'No species detected today'|trans }} #}
{% if today == date %}
{{ 'No species detected today.'|trans }}
{% else %}
{{ 'No species detected on '|trans }}
{{ date|format_datetime('full', 'none') }}
{% endif %}
{% endif %}
</li>
</ul>
</div>