From 09a63f78baa7db6af12983df6484507d9e5ef464 Mon Sep 17 00:00:00 2001 From: Greg Date: Sat, 10 May 2025 23:39:44 +0200 Subject: [PATCH] Manual Export Backup option in Report page --- app.py | 6 +++++- templates/reports.html | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index ab41020..4afe255 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, request, jsonify +from flask import Flask, render_template, request, jsonify, send_from_directory import json import os @@ -46,6 +46,10 @@ def update_data(): save_data(data) return jsonify({"status": "success"}) +@app.route('/export-data') +def export_data(): + return send_from_directory(directory='data', path='attendance_data.json', as_attachment=True) + if __name__ == '__main__': import os port = int(os.environ.get('PORT', 5000)) diff --git a/templates/reports.html b/templates/reports.html index 4a4a5f4..0f614cb 100644 --- a/templates/reports.html +++ b/templates/reports.html @@ -39,7 +39,10 @@ - Back to Attendance +
+ Back to Attendance + Export data +

Attendance Count per Player