Sha256: 0f649224aad8bffc9baae358de1c59a045fad0971c28908631366b67ff9256c0

Contents?: true

Size: 519 Bytes

Versions: 42

Compression:

Stored size: 519 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 ||= Thredded::Messageboard.ordered
    end
  end
end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
thredded-1.1.0 app/models/thredded/stats.rb
thredded-1.0.1 app/models/thredded/stats.rb
thredded-1.0.0 app/models/thredded/stats.rb
thredded-0.16.16 app/models/thredded/stats.rb
thredded-0.16.15 app/models/thredded/stats.rb
thredded-0.16.14 app/models/thredded/stats.rb
thredded-0.16.13 app/models/thredded/stats.rb
thredded-0.16.12 app/models/thredded/stats.rb
thredded-0.16.11 app/models/thredded/stats.rb
thredded-0.16.10 app/models/thredded/stats.rb
thredded-0.16.9 app/models/thredded/stats.rb
thredded-0.16.8 app/models/thredded/stats.rb
thredded-0.16.7 app/models/thredded/stats.rb
thredded-0.16.6 app/models/thredded/stats.rb
thredded-0.16.5 app/models/thredded/stats.rb
thredded-0.16.4 app/models/thredded/stats.rb
thredded-0.16.3 app/models/thredded/stats.rb
thredded-0.16.1 app/models/thredded/stats.rb
thredded-0.16.0 app/models/thredded/stats.rb
thredded-0.15.5 app/models/thredded/stats.rb