diff --git a/lookup.py b/lookup.py index 5142b22..da8648c 100755 --- a/lookup.py +++ b/lookup.py @@ -371,6 +371,15 @@ def reports() -> str: .limit(50) ) + missing_places = ( + database.session.query(model.LookupLog) + .filter( + model.LookupLog.result.has_key("missing") # type: ignore + ) # Filtering for entries where result contains 'missing' + .order_by(model.LookupLog.dt.desc()) # Ordering by dt in descending order + .limit(50) # Limiting to the top 50 results + ) + return render_template( "reports.html", log_count=log_count, @@ -378,6 +387,7 @@ def reports() -> str: average_response_time=average_response_time, by_day=by_day, top_places=top_places, + missing_places=missing_places, ) diff --git a/templates/reports.html b/templates/reports.html index 792a570..e0dcf20 100644 --- a/templates/reports.html +++ b/templates/reports.html @@ -14,6 +14,47 @@

Average response time: {{ average_response_time | int }} milliseconds

+

requests per day

+ +{% for day, day_count in by_day %} + + + + +{% endfor %} +
{{ day.strftime("%a %d %b %Y") }}{{ "{:,d}".format(day_count) }}
+ +

top places

+ +{% for place, place_count in top_places %} + + + + +{% endfor %} +
+ {% if place %} + {{ place }} + {% else %} + no place found + {% endif %} + {{ "{:,d}".format(place_count) }}
+ +

missing places

+

Recent queries that failed to resolve into a place with a category.

+ +{% for log in missing_places %} + + + + +{% endfor %} +
{{ log.dt.strftime("%a %d %b %Y at %H:%M:%S") }} + + {{ "{:.3f},{:.3f}".format(log.lat, log.lon) }} + +
+ {% endblock %}