From 26510d93c70995c01400d15a4bf05940fe2c566f Mon Sep 17 00:00:00 2001 From: Samuel Jones Date: Wed, 10 Jun 2026 08:50:04 +0100 Subject: [PATCH] Improvements to UX, introduced TOC filtering. --- media/template.html | 196 +++++++++++++++++++++++++++++----- src/fares_site/api_calling.py | 2 + src/fares_site/serve.py | 4 + 3 files changed, 176 insertions(+), 26 deletions(-) diff --git a/media/template.html b/media/template.html index 5438a07..cd9db62 100644 --- a/media/template.html +++ b/media/template.html @@ -1,5 +1,5 @@ - + @@ -8,6 +8,88 @@ + + - + -
+
-
+
- - - + - Ballast-Data Product | - Contact: Non-Doxxing Email Lorum Ipsum
- Some Header Content + Ballast-Data Product
+ Home | + Fares | + Stations | + About Us
@@ -51,9 +158,9 @@
-
+
-
+

@@ -63,11 +170,37 @@
-
+
- - - + + + + + + + + +
@@ -80,9 +213,20 @@
-
+ + + + diff --git a/src/fares_site/api_calling.py b/src/fares_site/api_calling.py index 3f0d4b2..7cf6b3f 100644 --- a/src/fares_site/api_calling.py +++ b/src/fares_site/api_calling.py @@ -26,4 +26,6 @@ def fares_query( environ.get("BD_FARES_PASS", ""), ), ) + if response.status_code != 200: + return [] return json.loads(response.content.decode()) # pyright: ignore[reportAny] diff --git a/src/fares_site/serve.py b/src/fares_site/serve.py index 8f0180d..3adfdc9 100644 --- a/src/fares_site/serve.py +++ b/src/fares_site/serve.py @@ -72,6 +72,10 @@ class FaresHandler(BaseHTTPRequestHandler): destination=destination, toc=query_terms.get("toc"), ) + if len(data) == 0: + text = "No Fares Found." + with open(template_path, "r") as rf: + return rf.read().replace("", text) text = '' text += ( '\n'
Flow Fares