Sha256: e8ccbdca60ec522d730f842c982e61fbbb38f58ebbaf3d10af6c975abcf2b1d3

Contents?: true

Size: 518 Bytes

Versions: 10

Compression:

Stored size: 518 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

10 entries across 10 versions & 1 rubygems

Version Path
thredded-0.12.1 app/models/thredded/stats.rb
thredded-0.12.0 app/models/thredded/stats.rb
thredded-0.11.1 app/models/thredded/stats.rb
thredded-0.11.0 app/models/thredded/stats.rb
thredded-0.10.1 app/models/thredded/stats.rb
thredded-0.10.0 app/models/thredded/stats.rb
thredded-0.9.4 app/models/thredded/stats.rb
thredded-0.9.3 app/models/thredded/stats.rb
thredded-0.9.2 app/models/thredded/stats.rb
thredded-0.9.1 app/models/thredded/stats.rb