From 083a51023c9bc4712112e9e00700675a8932fae2 Mon Sep 17 00:00:00 2001 From: Jan Novak Date: Tue, 24 Mar 2026 17:43:03 +0100 Subject: [PATCH] feat: Add Flush Cache tool page to web UI Adds a /flush-cache web page with a button to clear all cached Google Sheets data and reset refresh timers. Link added to Tools nav across all templates. Co-Authored-By: Claude Opus 4.6 --- app.py | 8 +- templates/adults.html | 1 + templates/fees-juniors.html | 1 + templates/fees.html | 1 + templates/flush-cache.html | 167 +++++++++++++++++++++++++++++++ templates/juniors.html | 1 + templates/payments.html | 1 + templates/reconcile-juniors.html | 1 + templates/reconcile.html | 1 + templates/sync.html | 1 + 10 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 templates/flush-cache.html diff --git a/app.py b/app.py index d34ccc9..d76763a 100644 --- a/app.py +++ b/app.py @@ -7,7 +7,7 @@ import os import io import qrcode import logging -from flask import Flask, render_template, g, send_file, request, jsonify +from flask import Flask, render_template, g, send_file, request # Configure logging, allowing override via LOG_LEVEL environment variable log_level = os.environ.get("LOG_LEVEL", "INFO").upper() @@ -117,10 +117,12 @@ def index(): # Redirect root to /adults for convenience while there are no other apps return '' -@app.route("/flush-cache", methods=["POST"]) +@app.route("/flush-cache", methods=["GET", "POST"]) def flush_cache_endpoint(): + if request.method == "GET": + return render_template("flush-cache.html") deleted = flush_cache() - return jsonify({"status": "ok", "deleted_files": deleted}) + return render_template("flush-cache.html", flushed=True, deleted=deleted) @app.route("/sync-bank") def sync_bank(): diff --git a/templates/adults.html b/templates/adults.html index e2de9c2..46a4ca2 100644 --- a/templates/adults.html +++ b/templates/adults.html @@ -467,6 +467,7 @@ diff --git a/templates/fees-juniors.html b/templates/fees-juniors.html index 1184682..d67a891 100644 --- a/templates/fees-juniors.html +++ b/templates/fees-juniors.html @@ -195,6 +195,7 @@ diff --git a/templates/fees.html b/templates/fees.html index 64d2eb8..de7b91f 100644 --- a/templates/fees.html +++ b/templates/fees.html @@ -210,6 +210,7 @@ diff --git a/templates/flush-cache.html b/templates/flush-cache.html new file mode 100644 index 0000000..7613e38 --- /dev/null +++ b/templates/flush-cache.html @@ -0,0 +1,167 @@ + + + + + + + FUJ - Flush Cache + + + + + + +

Flush Cache

+ + {% if flushed %} +
+ Cache flushed successfully. {{ deleted }} file(s) deleted. +
+ {% endif %} + +
+

Clears all cached Google Sheets data and resets refresh timers.

+
+ +
+
+ + + + + diff --git a/templates/juniors.html b/templates/juniors.html index 3bc005d..e2f60fa 100644 --- a/templates/juniors.html +++ b/templates/juniors.html @@ -467,6 +467,7 @@ diff --git a/templates/payments.html b/templates/payments.html index b33613d..1a8b428 100644 --- a/templates/payments.html +++ b/templates/payments.html @@ -199,6 +199,7 @@ diff --git a/templates/reconcile-juniors.html b/templates/reconcile-juniors.html index 3f33de1..7e3099e 100644 --- a/templates/reconcile-juniors.html +++ b/templates/reconcile-juniors.html @@ -463,6 +463,7 @@ diff --git a/templates/reconcile.html b/templates/reconcile.html index bcb89a5..eacc8a7 100644 --- a/templates/reconcile.html +++ b/templates/reconcile.html @@ -463,6 +463,7 @@ diff --git a/templates/sync.html b/templates/sync.html index 0c0f6ed..a2f2381 100644 --- a/templates/sync.html +++ b/templates/sync.html @@ -131,6 +131,7 @@