Sha256: 099d93f9903d032e9b04db433e079cd31813f16018a840480cdc11d748ebecf0

Contents?: true

Size: 508 Bytes

Versions: 3

Compression:

Stored size: 508 Bytes

Contents

# frozen_string_literal: true
module Thredded
  class Stats
    include ActionView::Helpers::NumberHelper

    def messageboards_count
      number_to_human(messageboards.count, precision: 4)
    end

    def topics_count
      number_to_human(messageboards.map(&:topics_count).sum, precision: 4)
    end

    def posts_count
      number_to_human(messageboards.map(&:posts_count).sum, precision: 5)
    end

    private

    def messageboards
      @messageboards ||= Messageboard.ordered
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thredded-0.8.4 app/models/thredded/stats.rb
thredded-0.8.2 app/models/thredded/stats.rb
thredded-0.7.0 app/models/thredded/stats.rb