Retrospring/app/controllers/about_controller.rb

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

31 lines
844 B
Ruby
Raw Normal View History

2022-07-18 07:26:11 -07:00
# frozen_string_literal: true
class AboutController < ApplicationController
def index; end
def about
2023-02-19 09:54:40 -08: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 01:55:35 -08: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 07:26:11 -07:00
end