Display some stats
This commit is contained in:
10
app/controllers/api/stats_controller.rb
Normal file
10
app/controllers/api/stats_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class Api::StatsController < Api::ApiController
|
||||
def show
|
||||
event_type = params[:event]
|
||||
unless event_type.present?
|
||||
return render json: {}, status: :bad_request
|
||||
end
|
||||
|
||||
render json: Ahoy::Event.where(name: event_type).group_by_day(:time).count
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user