retrospring/app/controllers/about_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
956 B
Ruby
Raw Normal View History

2022-07-18 16:26:11 +02:00
# frozen_string_literal: true
class AboutController < ApplicationController
def index
2024-08-11 05:02:03 +02:00
return unless Retrospring::Config.advanced_frontpage_enabled?
render template: "about/index_advanced"
end
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) }
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