adding statistics page for admin

This commit is contained in:
2025-09-14 17:07:05 +02:00
parent e947520be9
commit c4a5ed56b5
4 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
{% extends 'base.html' %} {% block content %}
<div id="admin-stats">
<h2>Database Statistics</h2>
<div class="stats-summary">
<p><strong>Total jobs:</strong> {{ stats.total_jobs }}</p>
<p><strong>Total keywords:</strong> {{ stats.total_keywords }}</p>
<p><strong>Total regions:</strong> {{ stats.total_regions }}</p>
</div>
<h3>Jobs per keyword</h3>
<table>
<thead>
<tr>
<th>Keyword</th>
<th>Count</th>
</tr>
</thead>
<tbody>
{% for row in stats.jobs_per_keyword %}
<tr>
<td>{{ row.keyword or '(empty)' }}</td>
<td>{{ row.count }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<h3>Jobs per region</h3>
<table>
<thead>
<tr>
<th>Region</th>
<th>Count</th>
</tr>
</thead>
<tbody>
{% for row in stats.jobs_per_region %}
<tr>
<td>{{ row.region or '(empty)' }}</td>
<td>{{ row.count }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View File

@@ -22,6 +22,7 @@
{% if current_user and current_user.is_admin %} |
<a href="{{ url_for('scrape_page') }}">Scrape Jobs</a> |
<a href="{{ url_for('admin_taxonomy') }}">Taxonomy</a> |
<a href="{{ url_for('admin_stats') }}">Statistics</a> |
<a href="{{ url_for('admin_users') }}">Users</a> {% endif %} {% if
session.get('username') %} |
<a href="{{ url_for('logout') }}">Logout</a> {% else %} |