2 Commits

Author SHA1 Message Date
083a51023c feat: Add Flush Cache tool page to web UI
Some checks failed
Deploy to K8s / deploy (push) Failing after 7s
Build and Push / build (push) Successful in 6s
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 <noreply@anthropic.com>
2026-03-24 17:43:03 +01:00
54762cd421 feat: Change QR payment message separator from "/" to ":"
Some checks failed
Deploy to K8s / deploy (push) Failing after 6s
Build and Push / build (push) Successful in 6s
Format is now "Name: MM/YYYY+MM/YYYY" instead of "Name / MM/YYYY+MM/YYYY"
for clearer readability when multiple months are included.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 17:35:46 +01:00
10 changed files with 184 additions and 7 deletions

8
app.py
View File

@@ -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 '<meta http-equiv="refresh" content="0; url=/adults" />'
@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():

View File

@@ -467,6 +467,7 @@
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank">[Sync Bank Data]</a>
<a href="/flush-cache">[Flush Cache]</a>
</div>
</div>
@@ -867,7 +868,7 @@
const numericMonth = rawMonth.includes('+')
? rawMonth.split('+').map(p => p.replace(/(\d{4})-(\d{2})/, '$2/$1')).join('+')
: rawMonth.replace(/(\d{4})-(\d{2})/, '$2/$1');
const message = `${name} / ${numericMonth}`;
const message = `${name}: ${numericMonth}`;
const qrTitle = document.getElementById('qrTitle');
const qrImg = document.getElementById('qrImg');
const qrAccount = document.getElementById('qrAccount');

View File

@@ -195,6 +195,7 @@
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank">[Sync Bank Data]</a>
<a href="/flush-cache">[Flush Cache]</a>
</div>
</div>

View File

@@ -210,6 +210,7 @@
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank">[Sync Bank Data]</a>
<a href="/flush-cache">[Flush Cache]</a>
</div>
</div>

167
templates/flush-cache.html Normal file
View File

@@ -0,0 +1,167 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FUJ - Flush Cache</title>
<style>
body {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
background-color: #0c0c0c;
color: #cccccc;
padding: 10px;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
font-size: 11px;
line-height: 1.2;
}
h1 {
color: #00ff00;
font-family: inherit;
margin-top: 10px;
margin-bottom: 20px;
text-transform: uppercase;
letter-spacing: 1px;
font-size: 14px;
}
.nav {
margin-bottom: 20px;
font-size: 12px;
color: #555;
display: flex;
flex-direction: column;
gap: 10px;
align-items: center;
}
.nav > div {
display: flex;
gap: 15px;
align-items: center;
}
.nav a {
color: #00ff00;
text-decoration: none;
padding: 2px 8px;
border: 1px solid #333;
}
.nav a.active {
color: #000;
background-color: #00ff00;
border-color: #00ff00;
}
.nav a:hover {
color: #fff;
border-color: #555;
}
.nav-archived a {
font-size: 10px;
color: #666;
border-color: #222;
}
.nav-archived a.active {
color: #ccc;
background-color: #333;
border-color: #555;
}
.nav-archived a:hover {
color: #999;
border-color: #444;
}
.flush-container {
background-color: #111;
border: 1px solid #333;
padding: 30px;
width: 100%;
max-width: 600px;
margin-bottom: 30px;
text-align: center;
}
.flush-btn {
font-family: inherit;
font-size: 12px;
color: #00ff00;
background-color: #1a1a1a;
border: 1px solid #00ff00;
padding: 8px 24px;
cursor: pointer;
text-transform: uppercase;
letter-spacing: 1px;
}
.flush-btn:hover {
background-color: #00ff00;
color: #000;
}
.status {
margin-bottom: 15px;
font-size: 12px;
}
.status-ok { color: #00ff00; }
.footer {
text-align: center;
color: #333;
margin-top: 20px;
font-size: 10px;
}
</style>
</head>
<body>
<div class="nav">
<div>
<a href="/adults">[Adults]</a>
<a href="/juniors">[Juniors]</a>
</div>
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Archived:</span>
<a href="/fees">[Adult - Attendance/Fees]</a>
<a href="/fees-juniors">[Junior Attendance/Fees]</a>
<a href="/reconcile">[Adult Payment Reconciliation]</a>
<a href="/reconcile-juniors">[Junior Payment Reconciliation]</a>
<a href="/payments">[Payments Ledger]</a>
</div>
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank">[Sync Bank Data]</a>
<a href="/flush-cache" class="active">[Flush Cache]</a>
</div>
</div>
<h1>Flush Cache</h1>
{% if flushed %}
<div class="status">
<span class="status-ok">Cache flushed successfully. {{ deleted }} file(s) deleted.</span>
</div>
{% endif %}
<div class="flush-container">
<p style="margin-bottom: 20px; color: #888;">Clears all cached Google Sheets data and resets refresh timers.</p>
<form method="POST" action="/flush-cache">
<button type="submit" class="flush-btn">[Flush Cache]</button>
</form>
</div>
<div class="footer">
{{ build_meta.tag }} | {{ build_meta.commit }} | {{ build_meta.build_date }}
</div>
</body>
</html>

View File

@@ -467,6 +467,7 @@
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank">[Sync Bank Data]</a>
<a href="/flush-cache">[Flush Cache]</a>
</div>
</div>
@@ -848,7 +849,7 @@
const numericMonth = rawMonth.includes('+')
? rawMonth.split('+').map(p => p.replace(/(\d{4})-(\d{2})/, '$2/$1')).join('+')
: rawMonth.replace(/(\d{4})-(\d{2})/, '$2/$1');
const message = `${name} / ${numericMonth}`;
const message = `${name}: ${numericMonth}`;
const qrTitle = document.getElementById('qrTitle');
const qrImg = document.getElementById('qrImg');
const qrAccount = document.getElementById('qrAccount');

View File

@@ -199,6 +199,7 @@
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank">[Sync Bank Data]</a>
<a href="/flush-cache">[Flush Cache]</a>
</div>
</div>

View File

@@ -463,6 +463,7 @@
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank">[Sync Bank Data]</a>
<a href="/flush-cache">[Flush Cache]</a>
</div>
</div>
@@ -851,7 +852,7 @@
const numericMonth = rawMonth.includes('+')
? rawMonth.split('+').map(p => p.replace(/(\d{4})-(\d{2})/, '$2/$1')).join('+')
: rawMonth.replace(/(\d{4})-(\d{2})/, '$2/$1');
const message = `${name} / ${numericMonth}`;
const message = `${name}: ${numericMonth}`;
const qrTitle = document.getElementById('qrTitle');
const qrImg = document.getElementById('qrImg');
const qrAccount = document.getElementById('qrAccount');

View File

@@ -463,6 +463,7 @@
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank">[Sync Bank Data]</a>
<a href="/flush-cache">[Flush Cache]</a>
</div>
</div>
@@ -851,7 +852,7 @@
const numericMonth = rawMonth.includes('+')
? rawMonth.split('+').map(p => p.replace(/(\d{4})-(\d{2})/, '$2/$1')).join('+')
: rawMonth.replace(/(\d{4})-(\d{2})/, '$2/$1');
const message = `${name} / ${numericMonth}`;
const message = `${name}: ${numericMonth}`;
const qrTitle = document.getElementById('qrTitle');
const qrImg = document.getElementById('qrImg');
const qrAccount = document.getElementById('qrAccount');

View File

@@ -131,6 +131,7 @@
<div class="nav-archived">
<span style="color: #666; margin-right: 5px;">Tools:</span>
<a href="/sync-bank" class="active">[Sync Bank Data]</a>
<a href="/flush-cache">[Flush Cache]</a>
</div>
</div>