From a8a434e99dc5d5ac66acdc8e2d2afb9c973e650f Mon Sep 17 00:00:00 2001 From: Maciej Pienczyn Date: Fri, 20 Feb 2026 09:18:54 +0100 Subject: [PATCH] feat: auto-load charts from DB cache on page load, show cache date Charts now render automatically on page load via AJAX from DB cache (no click needed). Info bar above charts shows post count, cache date, and hint to refresh. GET cache endpoint now returns cached_at date. Co-Authored-By: Claude Opus 4.6 --- blueprints/admin/routes_social_publisher.py | 3 +- templates/admin/social_publisher.html | 36 +++++++++++++-------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/blueprints/admin/routes_social_publisher.py b/blueprints/admin/routes_social_publisher.py index 38039c2..8184189 100644 --- a/blueprints/admin/routes_social_publisher.py +++ b/blueprints/admin/routes_social_publisher.py @@ -423,7 +423,8 @@ def social_publisher_get_posts_cache(company_id): cached = social_publisher.get_cached_posts(company_id) if cached and cached['posts']: - return jsonify({'success': True, 'posts': cached['posts'], 'total_count': cached['total_count']}) + cached_at = cached['cached_at'].strftime('%d.%m.%Y %H:%M') if cached.get('cached_at') else None + return jsonify({'success': True, 'posts': cached['posts'], 'total_count': cached['total_count'], 'cached_at': cached_at}) return jsonify({'success': False, 'error': 'Brak danych w cache. Kliknij Analityka aby pobrac.'}) diff --git a/templates/admin/social_publisher.html b/templates/admin/social_publisher.html index c60c94c..190d438 100644 --- a/templates/admin/social_publisher.html +++ b/templates/admin/social_publisher.html @@ -461,6 +461,7 @@