Class: Thredded::Stats

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::NumberHelper
Defined in:
app/models/thredded/stats.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.messageboards_count ⇒ Object



6
7
8
# File 'app/models/thredded/stats.rb', line 6

def messageboards_count
  new.messageboards_count
end

.posts_count ⇒ Object



14
15
16
# File 'app/models/thredded/stats.rb', line 14

def posts_count
  new.posts_count
end

.topics_count ⇒ Object



10
11
12
# File 'app/models/thredded/stats.rb', line 10

def topics_count
  new.topics_count
end

Instance Method Details

#messageboards_count ⇒ Object



19
20
21
# File 'app/models/thredded/stats.rb', line 19

def messageboards_count
  messageboards.count
end

#posts_count ⇒ Object



27
28
29
# File 'app/models/thredded/stats.rb', line 27

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

#topics_count ⇒ Object



23
24
25
# File 'app/models/thredded/stats.rb', line 23

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