2022-07-18 16:26:11 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class AboutController < ApplicationController
|
2024-08-11 04:52:21 +02:00
|
|
|
def index
|
2024-08-11 05:02:03 +02:00
|
|
|
return unless Retrospring::Config.advanced_frontpage_enabled?
|
|
|
|
|
|
|
|
render template: "about/index_advanced"
|
2024-08-11 04:52:21 +02:00
|
|
|
end
|
2022-07-18 16:51:03 +02:00
|
|
|
|
|
|
|
def about
|
2023-02-19 18:54:40 +01:00
|
|
|
@users = Rails.cache.fetch("about_count_users", expires_in: 1.hour) { user_count - current_ban_count }
|
|
|
|
@questions = Rails.cache.fetch("about_count_questions", expires_in: 1.hour) { Question.count(:id) }
|
|
|
|
@answers = Rails.cache.fetch("about_count_answers", expires_in: 1.hour) { Answer.count(:id) }
|
|
|
|
@comments = Rails.cache.fetch("about_count_comments", expires_in: 1.hour) { Comment.count(:id) }
|
2022-07-18 16:51:03 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def privacy_policy; end
|
|
|
|
|
|
|
|
def terms; end
|
2023-02-18 10:55:35 +01:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def user_count = User
|
|
|
|
.where.not(confirmed_at: nil)
|
|
|
|
.where("answered_count > 0")
|
|
|
|
.count
|
|
|
|
|
|
|
|
def current_ban_count = UserBan
|
|
|
|
.current
|
|
|
|
.joins(:user)
|
|
|
|
.where.not("users.confirmed_at": nil)
|
|
|
|
.where("users.answered_count > 0")
|
|
|
|
.count
|
2022-07-18 16:26:11 +02:00
|
|
|
end
|