Class: Api::V1::StatsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/api/v1/stats_controller.rb

Overview

The Api:V1:StatsController provides a backend API for requesting statistical information.

Author:

  • Robert Klubenspies

Since:

  • 0.2.0

Instance Method Summary collapse

Instance Method Details

#indexObject

Retrieves statistics about SAP

Author:

  • Robert Klubenspies

Since:

  • 0.2.0


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/api/v1/stats_controller.rb', line 13

def index
  # Retrieve all prayer requests
  @prayers = Prayer.all.entries
  
  # Determine total request count
  @request_count = @prayers.count
  
  # Set prayers count to zero, then count out total prayers placed
  @prayers_count = 0
  @prayers.each do |prayer|
    @prayers_count = @prayers_count + prayer.times_prayed_for
  end
end