add categories to dashboard
This commit is contained in:
parent
7c8fd33b69
commit
9d39f7178d
15
analytics.py
15
analytics.py
@ -384,7 +384,7 @@ def dashboard():
|
|||||||
WHERE timestamp >= ? {filetype_filter_sql}
|
WHERE timestamp >= ? {filetype_filter_sql}
|
||||||
GROUP BY rel_path
|
GROUP BY rel_path
|
||||||
ORDER BY access_count DESC
|
ORDER BY access_count DESC
|
||||||
LIMIT 20
|
LIMIT 1000
|
||||||
'''
|
'''
|
||||||
with log_db:
|
with log_db:
|
||||||
cursor = log_db.execute(query, params_for_filter)
|
cursor = log_db.execute(query, params_for_filter)
|
||||||
@ -400,6 +400,13 @@ def dashboard():
|
|||||||
for rel_path, access_count in rows
|
for rel_path, access_count in rows
|
||||||
]
|
]
|
||||||
|
|
||||||
|
top20_overall = rows[:20]
|
||||||
|
top20_predigt = [r for r in rows if r['category'] == 'Predigt'][:20]
|
||||||
|
top20_chor = [r for r in rows if r['category'] == 'Chor'][:20]
|
||||||
|
top20_ggesang = [r for r in rows if r['category'] == 'Gemeinsamer Gesang'][:20]
|
||||||
|
top20_glied = [r for r in rows if r['category'] == 'Gruppenlied'][:20]
|
||||||
|
|
||||||
|
|
||||||
# 2. Distinct device trend
|
# 2. Distinct device trend
|
||||||
# We'll group by hour if "today", by day if "7days"/"30days", by month if "365days"
|
# We'll group by hour if "today", by day if "7days"/"30days", by month if "365days"
|
||||||
if session['timeframe'] == 'last24hours':
|
if session['timeframe'] == 'last24hours':
|
||||||
@ -605,7 +612,11 @@ def dashboard():
|
|||||||
return render_template(
|
return render_template(
|
||||||
"dashboard.html",
|
"dashboard.html",
|
||||||
timeframe=session['timeframe'],
|
timeframe=session['timeframe'],
|
||||||
rows=rows,
|
top20_overall = top20_overall,
|
||||||
|
top20_predigt = top20_predigt,
|
||||||
|
top20_chor = top20_chor,
|
||||||
|
top20_ggesang = top20_ggesang,
|
||||||
|
top20_glied = top20_glied,
|
||||||
distinct_device_data=distinct_device_data,
|
distinct_device_data=distinct_device_data,
|
||||||
user_agent_data=user_agent_data,
|
user_agent_data=user_agent_data,
|
||||||
folder_data=folder_data,
|
folder_data=folder_data,
|
||||||
|
|||||||
@ -211,6 +211,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Detailed Table of Top File Accesses -->
|
<!-- Detailed Table of Top File Accesses -->
|
||||||
|
{% for top20 in [top20_overall, top20_predigt, top20_chor, top20_ggesang, top20_glied] %}
|
||||||
<div class="card mb-4">
|
<div class="card mb-4">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
Detaillierte Dateizugriffe (Top 20)
|
Detaillierte Dateizugriffe (Top 20)
|
||||||
@ -226,7 +227,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for row in rows %}
|
{% for row in top20 %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ row.rel_path }}</td>
|
<td>{{ row.rel_path }}</td>
|
||||||
<td>{{ row.access_count }}</td>
|
<td>{{ row.access_count }}</td>
|
||||||
@ -242,6 +243,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user