parent
e8c60e9f9b
commit
8bfe86ee82
15
lookup.py
15
lookup.py
|
@ -8,6 +8,7 @@ import sys
|
|||
import traceback
|
||||
import typing
|
||||
|
||||
import sqlalchemy
|
||||
import sqlalchemy.exc
|
||||
import werkzeug.debug.tbtools
|
||||
from flask import Flask, jsonify, redirect, render_template, request, url_for
|
||||
|
@ -323,5 +324,19 @@ def detail_page() -> Response | str:
|
|||
return build_detail_page(lat, lon)
|
||||
|
||||
|
||||
@app.route("/reports")
|
||||
def reports() -> str:
|
||||
"""Reports page with various statistics."""
|
||||
log_count = model.LookupLog.query.count()
|
||||
|
||||
log_start_time = database.session.query(
|
||||
sqlalchemy.func.min(model.LookupLog.dt)
|
||||
).scalar()
|
||||
|
||||
return render_template(
|
||||
"reports.html", log_count=log_count, log_start_time=log_start_time
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0")
|
||||
|
|
17
templates/reports.html
Normal file
17
templates/reports.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Geocode to Commons: Reports{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="m-3">
|
||||
<h1>Geocode reports</h1>
|
||||
|
||||
<p><a href="{{ url_for("index") }}">Back to index</a></p>
|
||||
|
||||
<p>Logging started {{ log_start_time.strftime("%a %d %b %Y") }}</p>
|
||||
|
||||
<p>Total lookups processed: {{ "{:,d}".format(log_count) }}</p>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in a new issue