Sha256: f1de7415226cace85f955f5dd6593e5f0afb9d558c016b6402e32e655e6e5e8d

Contents?: true

Size: 504 Bytes

Versions: 8

Compression:

Stored size: 504 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.all
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
thredded-0.6.3 app/models/thredded/stats.rb
thredded-0.6.2 app/models/thredded/stats.rb
thredded-0.6.1 app/models/thredded/stats.rb
thredded-0.6.0 app/models/thredded/stats.rb
thredded-0.5.1 app/models/thredded/stats.rb
thredded-0.5.0 app/models/thredded/stats.rb
thredded-0.4.0 app/models/thredded/stats.rb
thredded-0.3.2 app/models/thredded/stats.rb