dashboard improvement

This commit is contained in:
2025-05-31 12:53:41 +02:00
parent 36695c1398
commit 90bca4c93b
6 changed files with 71 additions and 48 deletions

View File

@@ -45,6 +45,12 @@ def init_routes(main_bp):
active_count = User.query.filter_by(is_active=True).count()
inactive_count = User.query.filter_by(is_active=False).count()
# Get recent events (last 7)
if current_user.is_admin:
recent_events = Event.query.order_by(Event.timestamp.desc()).limit(7).all()
else:
recent_events = Event.query.filter_by(user_id=current_user.id).order_by(Event.timestamp.desc()).limit(7).all()
# Room count and size logic
if current_user.is_admin:
logger.info("Loading admin dashboard...")
@@ -261,7 +267,9 @@ def init_routes(main_bp):
oldest_trash_date=oldest_trash_date,
trash_size=trash_size,
pending_deletion=pending_deletion,
trash_by_type=trash_by_type)
trash_by_type=trash_by_type,
recent_events=recent_events,
is_admin=current_user.is_admin)
UPLOAD_FOLDER = os.path.join(os.getcwd(), 'uploads', 'profile_pics')
if not os.path.exists(UPLOAD_FOLDER):