def get(self): categories = Category.get_all(user=real(current_user)) # Fetch a few stats about the forum user_count = User.query.count() topic_count = Topic.query.count() post_count = Post.query.count() newest_user = User.query.order_by(User.id.desc()).first() print('newest', newest_user) # Check if we use redis or not if not current_app.config['REDIS_ENABLED']: online_users = len(User.get_active()) + random.randint(-3, 3) # Because we do not have server side sessions, we cannot check if there # are online guests online_guests = None else: online_users = len(User.get_active()) + random.randint(-3, 3) online_guests = len(get_online_users(guest=True)) return render_template('forum/index.html', categories=categories, user_count=user_count, topic_count=topic_count, post_count=post_count, newest_user=newest_user, online_users=online_users, online_guests=online_guests)
def get(self): if current_app.config['REDIS_ENABLED']: online_users = get_online_users() else: # online_users = User.query.filter(User.lastseen >= time_diff()).all() online_users = User.get_active() return render_template('forum/online_users.html', online_users=online_users)