Add "last updated" to stats page

- inferred by looking at last updated collections
- may be wrong if "add collection" was used, but should work fine most times
master
Felix Stupp 2 years ago
parent bd72ad77bb
commit c5eecef42d
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -405,9 +405,11 @@ def force_refresh_collection(collection_id: int):
@flask_app.route("/stats")
def show_stats():
elements: List[MediaElement] = MediaElement.select()
collections: List[MediaCollection] = MediaCollection.select()
return render_template(
"stats.htm",
stats={
"last_updated": orm.max(c.last_updated for c in collections),
"media": {
"known": orm.count(elements),
"known_seconds": orm.sum(m.length for m in elements),

@ -11,6 +11,9 @@
{{ macros.body_header() }}
<h1>{{ title }}</h1>
<ul>
<li>
Last updated: {{ stats.last_updated }}
</li>
{% set cats = (
("Known", stats.media.known, stats.media.known_seconds),
("Watched", stats.media.watched, stats.media.watched_seconds),

Loading…
Cancel
Save